product.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <zj-page-layout :hasFooter="true">
  3. <template slot="header">
  4. <view class="search-container">
  5. <u-search
  6. shape="round"
  7. :showAction="false"
  8. placeholder="输入分类名称进行搜索"
  9. v-model="keyword"
  10. @search="searchData"
  11. @clear="searchData"
  12. >
  13. </u-search>
  14. </view>
  15. </template>
  16. <view class="main-container">
  17. <view class="right-list">
  18. <scroll-view scroll-y style="height: 100%">
  19. <view class="item" v-for="(item, index) in rightList" :key="index" @click="selectId = item.goodsCode">
  20. <view class="name">{{ item.goodsName }}</view>
  21. <view class="text">代码:{{ item.goodsCode }}</view>
  22. <view class="text">师傅库存:{{ item.qty }}</view>
  23. <view class="bottom">
  24. <view class="price"
  25. >¥{{ item.goodsAmount | priceFilter }}<text>/{{ item.goodsUnit }}</text></view
  26. >
  27. <view
  28. :style="`width: 50rpx; height: 50rpx; border-radius: 50%;background: ${
  29. selectId == item.goodsCode ? '#0379FF' : '#ebebeb'
  30. };display: flex;justify-content: center;align-items: center;color:#fff`"
  31. ><text>✔</text></view
  32. >
  33. </view>
  34. </view>
  35. <Loading :type="2" :loadStatus="loadStatus" :dataList="rightList" v-if="type == 'M'" />
  36. <view class="empty-container" v-if="type == 'P' && rightList.length < 1">
  37. <image src="@/packageMaterial/static/empty.jpg" mode="widthFix"></image>
  38. <view class="title">该产品大类下暂无可售配件商品</view>
  39. <view class="text">请联系网点在后台“辅材配件”-“配件资料管理”维护配件商品收费标准,再操作!</view>
  40. </view>
  41. </scroll-view>
  42. </view>
  43. </view>
  44. <template slot="footer">
  45. <view class="bottom-container">
  46. <u-button type="primary" text="保存" @click="submitData"></u-button>
  47. </view>
  48. </template>
  49. </zj-page-layout>
  50. </template>
  51. <script>
  52. import { getStorage } from '@/common/utils/storage.js'
  53. export default {
  54. data() {
  55. return {
  56. type: 'M',
  57. userMobile: '',
  58. orderNo: '',
  59. salesType: 'OUT',
  60. brandId: null,
  61. brandName: null,
  62. categoryId: null,
  63. categoryName: null,
  64. wbId: null, // 维保工单
  65. wbIsAllFee: null, // 维保工单是否包含全部费用
  66. wbPayType: null, // 维保工单费用支付方式
  67. keyword: '',
  68. leftList: [],
  69. rightList: [],
  70. loadStatus: 0,
  71. cartList: [],
  72. selectId: '',
  73. dijiIndex: 0,
  74. partsWebsitId: ''
  75. }
  76. },
  77. onLoad({
  78. partsWebsitId,
  79. dijiIndex,
  80. type,
  81. userMobile,
  82. orderNo,
  83. salesType,
  84. brandId,
  85. brandName,
  86. categoryId,
  87. categoryName,
  88. websitId,
  89. websitName,
  90. wbId,
  91. wbIsAllFee,
  92. wbPayType
  93. }) {
  94. this.dijiIndex = dijiIndex
  95. this.type = type
  96. this.userMobile = userMobile
  97. this.orderNo = orderNo
  98. this.categoryId = categoryId
  99. this.categoryName = categoryName
  100. this.partsWebsitId = partsWebsitId
  101. this.websitId = websitId
  102. this.websitName = websitName
  103. this.wbId = wbId
  104. this.wbIsAllFee = wbIsAllFee
  105. this.wbPayType = wbPayType
  106. uni.setNavigationBarTitle({
  107. title: '选择配件'
  108. })
  109. this.getRightList()
  110. },
  111. computed: {
  112. userInfo() {
  113. return getStorage('user')
  114. },
  115. idcard() {
  116. return this.userInfo.idCard
  117. }
  118. },
  119. methods: {
  120. // 获取右侧产品
  121. getRightList() {
  122. this.loadStatus = 1
  123. let url = '',
  124. params = {}
  125. url = '/app/parts/stock/exist/worker/stock/list'
  126. params = {
  127. partsAttr: 'NEW',
  128. identity: this.userInfo.idCard,
  129. partsWebsitId: this.partsWebsitId,
  130. websitId: this.websitId
  131. }
  132. this.$api
  133. .post(url, {
  134. pageNum: 1,
  135. pageSize: -1,
  136. partsName: this.keyword,
  137. ...params
  138. })
  139. .then(res => {
  140. this.loadStatus = 0
  141. console.log(res.data)
  142. let list = res.data.map(item => {
  143. return this.type === 'M'
  144. ? {
  145. goodsId: item.normId,
  146. goodsName: item.normName,
  147. goodsCode: item.normCode,
  148. goodsUnit: item.unit,
  149. goodsAmount: item.normAmount,
  150. num: 0,
  151. qty: item.qty
  152. }
  153. : {
  154. goodsId: item.goodsId,
  155. goodsName: item.goodsName,
  156. goodsCode: item.goodsId,
  157. goodsUnit: item.goodsStockUnit,
  158. goodsAmount: item.marketPrice,
  159. normType: 'M',
  160. num: 1,
  161. qty: item.qty
  162. }
  163. })
  164. for (let i = 0; i < list.length; i++) {
  165. for (let j = 0; j < this.cartList.length; j++) {
  166. if (list[i].goodsId == this.cartList[j].goodsId) {
  167. list[i].num = this.cartList[j].num
  168. }
  169. }
  170. }
  171. if (list.length < 1) {
  172. this.loadStatus = 2
  173. }
  174. this.rightList = list
  175. })
  176. .catch(() => {
  177. this.loadStatus = 2
  178. })
  179. },
  180. // 搜索
  181. searchData() {
  182. this.getRightList()
  183. },
  184. submitData() {
  185. var data = this.rightList.find(item => item.goodsCode == this.selectId)
  186. if (data) {
  187. this.$setStorage('materialSaleData', { ...data, dijiIndex: this.dijiIndex })
  188. this.$navToPage(
  189. {
  190. delta: 1
  191. },
  192. 'navigateBack'
  193. )
  194. } else {
  195. this.$toast('请选择')
  196. }
  197. }
  198. }
  199. }
  200. </script>
  201. <style lang="scss" scoped>
  202. .search-container {
  203. background: #ffffff;
  204. padding: 0 20rpx 20rpx;
  205. ::v-deep .u-search {
  206. height: 60rpx;
  207. input {
  208. background: #f7f8ff !important;
  209. }
  210. .u-search__content {
  211. background: #f7f8ff !important;
  212. height: 60rpx;
  213. }
  214. }
  215. }
  216. .empty-container {
  217. height: 100%;
  218. background: #ffffff;
  219. display: flex;
  220. flex-direction: column;
  221. align-items: center;
  222. padding: 0 100rpx;
  223. image {
  224. width: 300rpx;
  225. margin-top: 100rpx;
  226. }
  227. .title {
  228. font-size: 32rpx;
  229. }
  230. .text {
  231. margin-top: 20rpx;
  232. font-size: 28rpx;
  233. line-height: 32rpx;
  234. color: $sec-font;
  235. text-align: center;
  236. }
  237. }
  238. .main-container {
  239. display: flex;
  240. height: 100%;
  241. .left-list {
  242. width: 220rpx;
  243. height: 100%;
  244. overflow-y: scroll;
  245. box-sizing: border-box;
  246. flex-shrink: 0;
  247. .item {
  248. font-size: 28rpx;
  249. color: #333333;
  250. height: 88rpx;
  251. display: flex;
  252. align-items: center;
  253. padding: 0 20rpx;
  254. &.current {
  255. color: #ffffff;
  256. background: $theme-color;
  257. }
  258. }
  259. }
  260. .right-list {
  261. flex: 1;
  262. background: #ffffff;
  263. background: #ffffff;
  264. height: 100%;
  265. box-sizing: border-box;
  266. .item {
  267. padding: 20rpx;
  268. border-bottom: 1px solid #f5f5f5;
  269. .name {
  270. font-size: 32rpx;
  271. font-weight: 500;
  272. }
  273. .text {
  274. font-size: 28rpx;
  275. color: $sec-font;
  276. margin-top: 12rpx;
  277. }
  278. .bottom {
  279. display: flex;
  280. align-items: center;
  281. justify-content: space-between;
  282. margin-top: 12rpx;
  283. .price {
  284. font-size: 28rpx;
  285. font-weight: 500;
  286. color: $minor-color;
  287. text {
  288. font-weight: normal;
  289. color: $sec-font;
  290. margin-left: 8rpx;
  291. }
  292. }
  293. .input {
  294. width: 50rpx;
  295. text-align: center;
  296. padding: 0 10px;
  297. }
  298. .ctrl {
  299. width: 40rpx;
  300. height: 40rpx;
  301. background-color: $theme-color;
  302. border-radius: 50%;
  303. display: flex;
  304. justify-content: center;
  305. align-items: center;
  306. }
  307. }
  308. }
  309. }
  310. }
  311. .bottom-container {
  312. display: flex;
  313. align-items: center;
  314. padding: 20rpx;
  315. .cart {
  316. flex-shrink: 0;
  317. width: 110rpx;
  318. height: 110rpx;
  319. border-radius: 50%;
  320. background: $theme-color;
  321. position: relative;
  322. display: flex;
  323. align-items: center;
  324. justify-content: center;
  325. margin-top: -40rpx;
  326. .iconfont {
  327. font-size: 52rpx;
  328. color: #ffffff;
  329. font-weight: 600;
  330. }
  331. }
  332. .price {
  333. margin-left: 20rpx;
  334. flex: 1;
  335. font-size: 32rpx;
  336. color: $minor-color;
  337. font-weight: 500;
  338. text {
  339. font-weight: normal;
  340. color: $sec-font;
  341. }
  342. }
  343. .btn {
  344. width: 180rpx;
  345. // ::v-deep .u-button {
  346. // height: 60rpx;
  347. // }
  348. }
  349. }
  350. .dialog-mark {
  351. position: fixed;
  352. top: 0;
  353. left: 0;
  354. width: 100%;
  355. height: 100%;
  356. background: rgba($color: #000000, $alpha: 0.6);
  357. }
  358. .dialog-container {
  359. width: 100%;
  360. box-sizing: border-box;
  361. background: #ffffff;
  362. position: fixed;
  363. bottom: 100rpx;
  364. left: 0;
  365. padding: 30rpx;
  366. .top {
  367. display: flex;
  368. align-items: center;
  369. justify-content: space-between;
  370. .left {
  371. font-size: 32rpx;
  372. font-weight: 500;
  373. }
  374. .right {
  375. display: flex;
  376. align-items: center;
  377. font-size: 28rpx;
  378. color: $sec-font;
  379. text {
  380. font-size: 32rpx;
  381. margin-right: 8rpx;
  382. }
  383. }
  384. }
  385. .list {
  386. max-height: 400rpx;
  387. overflow-y: scroll;
  388. margin-top: 20rpx;
  389. .item {
  390. padding: 20rpx 0;
  391. border-bottom: 1px solid #f5f5f5;
  392. &:last-child {
  393. border: none;
  394. }
  395. .name {
  396. font-size: 32rpx;
  397. font-weight: 500;
  398. }
  399. .text {
  400. font-size: 28rpx;
  401. color: $sec-font;
  402. margin-top: 12rpx;
  403. }
  404. .bottom {
  405. display: flex;
  406. align-items: center;
  407. justify-content: space-between;
  408. margin-top: 12rpx;
  409. .price {
  410. font-size: 28rpx;
  411. font-weight: 500;
  412. color: $minor-color;
  413. text {
  414. font-weight: normal;
  415. color: $sec-font;
  416. margin-left: 8rpx;
  417. }
  418. }
  419. .input {
  420. width: 50rpx;
  421. text-align: center;
  422. padding: 0 10px;
  423. }
  424. .ctrl {
  425. width: 40rpx;
  426. height: 40rpx;
  427. background-color: $theme-color;
  428. border-radius: 50%;
  429. display: flex;
  430. justify-content: center;
  431. align-items: center;
  432. }
  433. }
  434. }
  435. }
  436. }
  437. </style>