shoppingCart.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. <template>
  2. <view v-if="checkStatus == '通过'">
  3. <view style="width: 100%;height: 155rpx;background: #FFFFFF;display: flex;align-items: center;" v-if="!editDel"
  4. @click="clickAddress">
  5. <view>
  6. <view style="font-size: 28rpx;color: #3B3B3B;font-weight: 400;display: flex;align-items: center;">
  7. <image src="/static/images/tabBar/1061@2x.png"
  8. style="width: 25rpx;height: 30rpx;margin-left: 34rpx;margin-right: 2rpx;" mode="scaleToFill">
  9. <text>{{addres.contacts}}</text>
  10. <text style="margin-left: 35rpx;">{{addres.tel}}</text>
  11. </view>
  12. <view style="font-size: 26rpx;color:#989898;font-weight: 400;margin-top: 22rpx;margin-left: 61rpx;">
  13. <text>{{addres.belongtoarea + addres.detailedAddress}}</text>
  14. </view>
  15. </view>
  16. </view>
  17. <scroll-view scroll-y="true" style="max-height: 68vh;">
  18. <u-checkbox-group v-model="companyValue" placement="column" @change="companyChange" :size='15'>
  19. <view class="card" v-for="(item,index) in dataList" :key="index">
  20. <view>
  21. <u-checkbox activeColor="#E75F37" shape="circle" :customStyle="{marginBottom: '8px'}"
  22. :label="item.name" :name="item.name" labelSize="28rpx" labelColor='#3B3B3B'></u-checkbox>
  23. </view>
  24. <view style="background: #FCF7F5;padding: 30rpx 30rpx;">
  25. <view style="margin:15rpx 0 15rpx 20rpx;display: flex;align-items: center;"
  26. v-for="(ite,ind) in item.list" :key="ind">
  27. <view>
  28. <image v-for="(li,inde) in ite.filesList" :key="inde" v-if="li.version === '0'"
  29. :src="li.url" style="width: 200rpx;height: 200rpx;border-radius: 20rpx;">
  30. </image>
  31. </view>
  32. <view style="width: 100%;">
  33. <view style="display: flex;justify-content: space-between;">
  34. <u--text :text="ite.goodsName" size="24rpx" color='#797979' lines="2"></u--text>
  35. <u-icon name="trash" size="40rpx" color='#C9C9C9'
  36. @click="deleteGoods(ite.id)"></u-icon>
  37. </view>
  38. <view style="display: flex;justify-content: space-between;margin-top: 20rpx;">
  39. <view style="color: #E75F37;font-size: 32rpx;">¥{{ite.price}}</view>
  40. <view v-if="!editDel">
  41. <u-number-box v-model="ite.goodsNum" :min="1" buttonSize="53rpx" color="#414141"
  42. bgColor="#FCF7F5" iconStyle="color:#A4A4A4"
  43. @change="(val)=>{statistics(val,index,ind)}"></u-number-box>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </u-checkbox-group>
  51. </scroll-view>
  52. <view class="submitBar">
  53. <view style="margin:20rpx 47rpx;">
  54. <view v-if="!editDel"
  55. style="display: flex;justify-content: space-between;align-items: flex-end;padding: 28rpx 0 28rpx 28rpx;">
  56. <u-checkbox-group v-model="radiovalue" placement="column" @change="radioGroupChange" :size='15'>
  57. <u-checkbox label="全选" name="全选" activeColor="#E75F37" shape="circle" labelSize="28rpx"
  58. labelColor='#3B3B3B'></u-checkbox>
  59. </u-checkbox-group>
  60. <view style="font-size: 24rpx;">合计:<text style="color: #E75F37;">¥</text><text
  61. style="font-size: 42rpx;color: #E75F37;">{{totalPrice}}</text></view>
  62. </view>
  63. <view style="height: 2rpx;width: 100%;background: #EEEEEE;">
  64. </view>
  65. <view
  66. style="display: flex;justify-content:space-between;align-items: center;padding: 28rpx 0 28rpx 28rpx;">
  67. <view v-if="!editDel" style="font-size: 24rpx;">
  68. <view style="color:#A3A3A3">运费:<text style="color: #E75F37;">¥{{totalFreight}}</text></view>
  69. </view>
  70. <view style="display: flex;">
  71. <view class="right-btn" v-if="!editDel" @click="submit()">立即兑换
  72. </view>
  73. </view>
  74. </view>
  75. <view style="height: 2rpx;width: 100%;background: #EEEEEE;">
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. import {
  83. shoppingCartList,
  84. generateOrder,
  85. generateOrderLimit,
  86. shoppingCartUpdate,
  87. getCorpsAddr,
  88. paramserviceDetail,
  89. getParamservice,
  90. isProcurement,
  91. generateOrderPoints
  92. } from '@/api/tabBar/shoppingCart.js'
  93. import {
  94. registerRuntimeCompiler
  95. } from "vue"
  96. import {
  97. details
  98. } from '@/api/views/personalInformation/index.js'
  99. import {
  100. appDetail
  101. } from '@/api/views/salesSlip/index.js'
  102. import {
  103. activityList
  104. } from '@/api/tabBar/activity.js'
  105. export default {
  106. data() {
  107. return {
  108. qrcodeshow: false, // 二维码弹窗
  109. qrcodeData: [], // 二维码数据
  110. qrcodeurl: '', // 二维码参数
  111. editDel: false,
  112. radiovalue: [],
  113. companyValue: [],
  114. dataList: [],
  115. companyValueLength: 0,
  116. selectedProduct: [],
  117. totalPrice: 0,
  118. totalFreight: 0,
  119. addres: {},
  120. checkStatus: null,
  121. adminShow: false,
  122. inventoryShow: false,
  123. inventoryContent: '',
  124. freight: 5,
  125. }
  126. },
  127. options: {
  128. styleIsolation: 'shared', // 解除样式隔离
  129. },
  130. watch: {
  131. companyValue() {
  132. if (this.companyValue.length != 0 || this.companyValueLength != 0) {
  133. if (this.companyValue.length == this.companyValueLength) {
  134. this.radiovalue = ["全选"]
  135. } else {
  136. this.radiovalue = []
  137. }
  138. }
  139. this.statistics()
  140. }
  141. },
  142. created() {
  143. activityList({
  144. current: 1,
  145. size: 10,
  146. status: 1
  147. }).then(res => {
  148. uni.setTabBarBadge({
  149. index: 2, // tabIndex,tabBar的哪一项,从0开始
  150. text: res.data.total.toString() // 显示的文本,超过 99 显示成 “…”
  151. })
  152. })
  153. if (uni.getStorageSync('userInfo').tenant_id == '000000') {
  154. this.adminShow = true
  155. return
  156. }
  157. // 获取审核状态
  158. details().then(res => {
  159. this.checkStatus = res.data.checkStatus
  160. uni.setStorageSync('checkStatus', res.data.checkStatus);
  161. console.log(1111111)
  162. if (this.checkStatus != '通过') {
  163. uni.showToast({
  164. title: "当前用户未授权,请联系客服",
  165. icon: "none",
  166. mask: true
  167. });
  168. // uni.switchTab({
  169. // url:'/pages/tabBar/home'
  170. // })
  171. // return
  172. }
  173. })
  174. this.editDel = false
  175. this.companyValue = []
  176. shoppingCartList({
  177. whetherIntegral: '1'
  178. }).then(res => {
  179. this.dataList = res.data
  180. this.companyValueLength = this.dataList.length
  181. this.inventoryfun(res.data)
  182. let num = 0
  183. res.data.forEach(e => {
  184. console.log(e.list)
  185. num = num + e.list.length
  186. })
  187. uni.setTabBarBadge({
  188. index: 3, // tabIndex,tabBar的哪一项,从0开始
  189. text: num.toString() // 显示的文本,超过 99 显示成 “…”
  190. })
  191. })
  192. getCorpsAddr().then(res => {
  193. this.addres = res.data
  194. })
  195. // 支付成功之后的回调
  196. let options = wx.getEnterOptionsSync();
  197. if (options.scene == '1038' && options.referrerInfo.appId == 'wxef277996acc166c3') {
  198. // 代表从收银台小程序返回
  199. let extraData = options.referrerInfo.extraData;
  200. if (!extraData) {
  201. // "当前通过物理按键返回,未接收到返参,建议自行查询交易结果";
  202. console.log('当前通过物理按键返回,未接收到返参,建议自行查询交易结果');
  203. } else {
  204. if (extraData.code == 'success') {
  205. // "支付成功";
  206. } else if (extraData.code == 'cancel') {
  207. // "支付已取消";
  208. console.log(extraData, '支付已取消');
  209. } else {
  210. console.log(extraData, '失败');
  211. // "支付失败:" + extraData.errmsg;
  212. }
  213. }
  214. }
  215. isProcurement({
  216. "param": "freight"
  217. }).then(res => {
  218. // res.data.data === '1'
  219. this.freight = res.data
  220. })
  221. },
  222. methods: {
  223. tabbarClick(tab) {
  224. // uni.$u.route('/pages/integralMall/'+tab);
  225. uni.navigateTo({
  226. url: '/pages/integralMall/' + tab
  227. })
  228. },
  229. // 库存弹窗
  230. inventoryfun(arr) {
  231. let sum = ''
  232. arr.map((item, index) => {
  233. item.list.map(ite => {
  234. if (Number(ite.goodsNum) > Number(ite.inventory)) {
  235. sum += `${ite.goodsName} 的库存数量为${ite.inventory}<br>`
  236. }
  237. return ite
  238. })
  239. return item
  240. })
  241. if (sum != '') {
  242. this.inventoryContent = sum + '请修正数量后重新结算'
  243. this.inventoryShow = true
  244. return true
  245. }
  246. return false
  247. },
  248. // admin确认
  249. adminConfirm() {
  250. uni.clearStorageSync();
  251. uni.redirectTo({
  252. url: '/pages/login/login'
  253. })
  254. },
  255. // admin取消
  256. adminCancel() {
  257. uni.switchTab({
  258. url: '/pages/tabBar/home'
  259. })
  260. },
  261. // 弹窗关闭
  262. qrcodeclose() {
  263. this.qrcodeshow = false
  264. uni.showLoading({
  265. title: '加载中',
  266. mask: true
  267. });
  268. // 详情调用
  269. shoppingCartList({
  270. whetherIntegral: '1'
  271. }).then(res => {
  272. this.dataList = res.data
  273. this.companyValueLength = this.dataList.length
  274. uni.hideLoading();
  275. }).catch(err => {
  276. uni.hideLoading();
  277. })
  278. },
  279. clickAddress() {
  280. this.$u.route('/pages/views/personalInformation/addressManagement');
  281. },
  282. getList() {
  283. shoppingCartList({
  284. whetherIntegral: '1'
  285. }).then(res => {
  286. this.dataList = res.data
  287. this.companyValueLength = this.dataList.length
  288. let num = 0
  289. res.data.forEach(e => {
  290. num = num + e.list.length
  291. })
  292. uni.setTabBarBadge({
  293. index: 3, // tabIndex,tabBar的哪一项,从0开始
  294. text: num.toString() // 显示的文本,超过 99 显示成 “…”
  295. })
  296. uni.hideLoading();
  297. }).catch(err => {
  298. uni.hideLoading();
  299. })
  300. },
  301. deleteGoods(val) {
  302. let _this = this
  303. uni.showModal({
  304. title: '提示',
  305. content: '是否删除?',
  306. success: function(res) {
  307. if (res.confirm) {
  308. uni.showLoading({
  309. title: '加载中',
  310. mask: true
  311. });
  312. shoppingCartUpdate({
  313. ids: val
  314. }).then(res => {
  315. uni.showToast({
  316. title: "删除成功",
  317. icon: 'none'
  318. });
  319. uni.showLoading({
  320. title: '加载中',
  321. mask: true
  322. });
  323. _this.getList()
  324. // this.editDel = false
  325. _this.companyValue = []
  326. uni.hideLoading();
  327. }).catch(err => {
  328. uni.hideLoading();
  329. })
  330. } else if (res.cancel) {
  331. console.log('用户点击取消');
  332. }
  333. }
  334. });
  335. },
  336. deleteShopping() {
  337. if (this.selectedProduct.length == 0) {
  338. uni.showToast({
  339. title: "请先选择要支付的商品",
  340. icon: 'none'
  341. });
  342. return
  343. }
  344. let data = []
  345. for (let item of this.companyValue) {
  346. for (let ite of this.dataList) {
  347. if (item == ite.name) {
  348. for (let it of ite.list) {
  349. data.push(it.id)
  350. }
  351. }
  352. }
  353. }
  354. uni.showLoading({
  355. title: '加载中',
  356. mask: true
  357. });
  358. shoppingCartUpdate({
  359. ids: data.join(',')
  360. }).then(res => {
  361. uni.showToast({
  362. title: "删除成功",
  363. icon: 'none'
  364. });
  365. uni.hideLoading();
  366. uni.showLoading({
  367. title: '加载中',
  368. mask: true
  369. });
  370. this.editDel = false
  371. this.companyValue = []
  372. shoppingCartList({
  373. whetherIntegral: '1'
  374. }).then(res => {
  375. this.dataList = res.data
  376. this.companyValueLength = this.dataList.length
  377. uni.hideLoading();
  378. }).catch(err => {
  379. uni.hideLoading();
  380. })
  381. }).catch(err => {
  382. uni.hideLoading();
  383. })
  384. },
  385. // 立即支付
  386. async submit() {
  387. if (this.selectedProduct.length == 0) {
  388. uni.showToast({
  389. title: "请先选择要支付的商品",
  390. icon: 'none'
  391. });
  392. return
  393. }
  394. if (this.inventoryfun(this.dataList)) {
  395. return
  396. }
  397. if (this.companyValue.length > 0) {
  398. let data = []
  399. for (let item of this.companyValue) {
  400. for (let ite of this.dataList) {
  401. if (item == ite.name) {
  402. data.push({
  403. name: item,
  404. list: ite.list
  405. })
  406. }
  407. }
  408. }
  409. let _this = this
  410. uni.showModal({
  411. title: '提示',
  412. content: '是否确认兑换?',
  413. success: function(res) {
  414. if (res.confirm) {
  415. uni.showLoading({
  416. title: '加载中',
  417. mask: true
  418. });
  419. generateOrderPoints({
  420. address: _this.addres.belongtoarea + _this.addres
  421. .detailedAddress,
  422. list: data,
  423. }).then(res => {
  424. uni.hideLoading({
  425. noConflict: true
  426. });
  427. uni.showToast({
  428. title: res.data,
  429. icon: "none",
  430. });
  431. shoppingCartList({
  432. whetherIntegral: '1'
  433. }).then(res => {
  434. _this.dataList = res.data
  435. _this.companyValueLength = _this.dataList.length
  436. })
  437. })
  438. }
  439. }
  440. });
  441. // 判断是否用额度支付
  442. // const personRef = await details()
  443. // console.log(personRef.data, 349);
  444. // const totalPrice = Number(this.totalPrice) + Number(this.totalFreight)
  445. // 是否开通额度
  446. // getParamservice(1, 10, {
  447. // paramKey: 'WeChat.shipping.notification'
  448. // }).then(res => {
  449. // console.log(res)
  450. // if (res.data.records.length > 0) {
  451. // let payType = res.data.records[0].paramValue == 1 ? 'W11' : 'W06'
  452. // if (personRef.data.ifLimitAmount == 1) {
  453. // // 额度是否够用
  454. // if (Number(personRef.data.limitAmount >= totalPrice)) {
  455. // // 额度
  456. // // this.payType='W06'
  457. // generateOrderLimit({
  458. // payType: res.data.records[0].paramValue == 1 ? 'W11' : 'W06',
  459. // address: this.addres.belongtoarea + this.addres.detailedAddress,
  460. // list: data,
  461. // }).then(res => {
  462. // uni.hideLoading();
  463. // uni.showToast({
  464. // title: '支付成功',
  465. // mask: true,
  466. // duration: 2000
  467. // });
  468. // setTimeout(function() {
  469. // uni.hideLoading();
  470. // }, 1000);
  471. // // 详情调用
  472. // shoppingCartList().then(res => {
  473. // this.dataList = res.data
  474. // this.companyValueLength = this.dataList.length
  475. // }).catch(err => {})
  476. // })
  477. // return
  478. // }
  479. // }
  480. // // 正常支付
  481. // generateOrder({
  482. // payType: res.data.records[0].paramValue == 1 ? 'W11' : 'W06',
  483. // address: this.addres.belongtoarea + this.addres.detailedAddress,
  484. // list: data,
  485. // }).then(res => {
  486. // let generateOrderData = res.data
  487. // paramserviceDetail({
  488. // paramKey: 'cashier.payment'
  489. // }).then(res => {
  490. // let paramservice = res.data
  491. // // paramservice.paramValue=0
  492. // // 判断是调支付台的接口还是微信支付的接口
  493. // if (paramservice && paramservice.paramValue == '1') {
  494. // console.log(222211111111);
  495. // // uni.hideLoading();
  496. // // uni.requestPayment({
  497. // // provider: "wxpay",
  498. // // appId: generateOrderData.appId,
  499. // // timeStamp: generateOrderData.timeStamp,
  500. // // nonceStr: generateOrderData.nonceStr,
  501. // // package: generateOrderData.package,
  502. // // signType: generateOrderData.signType,
  503. // // paySign: generateOrderData.paySign,
  504. // // success(res) {
  505. // // uni.showToast({
  506. // // title: '支付成功',
  507. // // mask: true,
  508. // // duration: 2000
  509. // // });
  510. // // setTimeout(function() {
  511. // // uni.hideLoading();
  512. // // // this_.refresh(res.data.data.id)
  513. // // }, 1000);
  514. // // },
  515. // // fail(e) {
  516. // // console.log(e,11111111);
  517. // // uni.showToast({
  518. // // title: "支付失败",
  519. // // icon: 'none',
  520. // // mask: true
  521. // // });
  522. // // setTimeout(function() {
  523. // // uni.hideLoading();
  524. // // // this_.refresh(res.data.id)
  525. // // }, 1000);
  526. // // }
  527. // // })
  528. // let obj = {
  529. // appId: 'wxef277996acc166c3',
  530. // extraData: {
  531. // cusid: generateOrderData.cusid,
  532. // appid: generateOrderData.appid,
  533. // orgid: generateOrderData.orgid,
  534. // version: generateOrderData.version,
  535. // trxamt: generateOrderData.trxamt,
  536. // reqsn: generateOrderData.reqsn,
  537. // notify_url: generateOrderData.notify_url,
  538. // body: generateOrderData.body,
  539. // remark: generateOrderData.remark,
  540. // validtime: generateOrderData.validtime,
  541. // limit_pay: generateOrderData.limit_pay,
  542. // randomstr: generateOrderData.randomstr,
  543. // paytype: generateOrderData.paytype,
  544. // signtype: generateOrderData.signtype,
  545. // sign: generateOrderData.sign,
  546. // },
  547. // }
  548. // console.log(obj);
  549. // if (!generateOrderData.reqsn) {
  550. // uni.showToast({
  551. // title: '当前订单号为空,请联系供应商!!!',
  552. // icon: 'none',
  553. // mask: true,
  554. // duration: 2000
  555. // });
  556. // // 详情调用
  557. // shoppingCartList().then(res => {
  558. // this.dataList = res.data
  559. // this.companyValueLength = this.dataList
  560. // .length
  561. // }).catch(err => {})
  562. // return
  563. // }
  564. // wx.openEmbeddedMiniProgram({
  565. // appId: 'wxef277996acc166c3',
  566. // extraData: {
  567. // cusid: generateOrderData.cusid,
  568. // appid: generateOrderData.appid,
  569. // orgid: generateOrderData.orgid,
  570. // version: generateOrderData.version,
  571. // trxamt: generateOrderData.trxamt,
  572. // reqsn: generateOrderData.reqsn,
  573. // notify_url: generateOrderData
  574. // .notify_url,
  575. // body: generateOrderData.body,
  576. // remark: generateOrderData.remark,
  577. // validtime: generateOrderData.validtime,
  578. // // limit_pay: generateOrderData.limit_pay,
  579. // limit_pay: "",
  580. // randomstr: generateOrderData.randomstr,
  581. // paytype: generateOrderData.paytype,
  582. // signtype: generateOrderData.signtype,
  583. // sign: generateOrderData.sign,
  584. // },
  585. // success: (a) => {
  586. // uni.hideLoading();
  587. // },
  588. // fail: (err) => {
  589. // uni.hideLoading();
  590. // }
  591. // })
  592. // } else {
  593. // console.log(2222222222222222);
  594. // if (payType && (payType == 'W01' || payType == 'U01' ||
  595. // payType == 'A01' || payType == 'S01'
  596. // )) {
  597. // console.log(generateOrderData, 321);
  598. // // 订单详情接口
  599. // this.qrcodeurl = generateOrderData.url
  600. // appDetail({
  601. // id: generateOrderData.id
  602. // }).then(res => {
  603. // uni.hideLoading();
  604. // this.qrcodeshow = true
  605. // this.qrcodeData = res.data
  606. // console.log(res.data);
  607. // })
  608. // } else {
  609. // uni.requestPayment({
  610. // provider: "wxpay",
  611. // appId: generateOrderData.appId,
  612. // timeStamp: generateOrderData.timeStamp,
  613. // nonceStr: generateOrderData.nonceStr,
  614. // package: generateOrderData.package,
  615. // signType: generateOrderData.signType,
  616. // paySign: generateOrderData.paySign,
  617. // success(res) {
  618. // uni.showToast({
  619. // title: '支付成功',
  620. // mask: true,
  621. // duration: 2000
  622. // });
  623. // setTimeout(function() {
  624. // uni.hideLoading();
  625. // // this_.refresh(res.data.data.id)
  626. // }, 1000);
  627. // },
  628. // fail(e) {
  629. // console.log(22222222);
  630. // uni.showToast({
  631. // title: "支付失败",
  632. // icon: 'none',
  633. // mask: true
  634. // });
  635. // setTimeout(function() {
  636. // uni.hideLoading();
  637. // // this_.refresh(res.data.id)
  638. // }, 1000);
  639. // }
  640. // })
  641. // }
  642. // }
  643. // })
  644. // }).catch(err => {
  645. // uni.hideLoading();
  646. // })
  647. // }
  648. // })
  649. }
  650. },
  651. radioGroupChange(e) {
  652. this.radiovalue = e
  653. if (e.length == 0) {
  654. this.companyValue = []
  655. } else {
  656. for (let li of this.dataList) {
  657. if (!this.companyValue.includes(li.name)) {
  658. this.companyValue.push(li.name)
  659. }
  660. }
  661. }
  662. this.inventoryfun(this.dataList)
  663. this.statistics()
  664. },
  665. statistics(val, index, ind) {
  666. console.log(val, index, ind)
  667. if (val) {
  668. this.dataList[index].list[ind].goodsNum = val.value
  669. }
  670. let data = []
  671. // for (let item of this.companyValue) {
  672. // for (let ite of this.dataList) {
  673. // if (item == ite.name) {
  674. // for (let it of ite.list) {
  675. // data.push(it)
  676. // }
  677. // }
  678. // }
  679. // }、
  680. for (let item of this.companyValue) {
  681. for (let ite of this.dataList) {
  682. if (item == ite.name) {
  683. data.push({
  684. name: item,
  685. list: ite.list
  686. })
  687. }
  688. }
  689. }
  690. this.totalPrice = 0
  691. this.totalFreight = 0
  692. let num = 0
  693. for (let item of data) {
  694. let num1 = 0
  695. for (let items of item.list) {
  696. this.totalPrice += Number(items.price) * Number(items.goodsNum)
  697. num += Number(items.goodsNum)
  698. num1 += Number(items.goodsNum)
  699. }
  700. if (num1 == 1) {
  701. this.totalFreight += this.freight ? Number(this.freight) : 5
  702. this.totalPrice = Number(this.totalPrice) + Number(this.totalFreight)
  703. }
  704. }
  705. /* if(num>1){
  706. this.totalFreight = 0
  707. } */
  708. this.totalFreight = this.totalFreight.toFixed(2)
  709. this.totalPrice = this.totalPrice
  710. this.selectedProduct = data
  711. },
  712. companyChange(n) {
  713. this.companyValue = n
  714. this.inventoryfun(this.dataList)
  715. }
  716. }
  717. }
  718. </script>
  719. <style lang="scss" scoped>
  720. .card {
  721. background: #FFFFFF;
  722. padding: 32rpx;
  723. margin: 20rpx 0;
  724. ::v-deep .u-checkbox__icon-wrap {
  725. border-color: #E75F37 !important;
  726. }
  727. ::v-deep .u-number-box {
  728. border: 2rpx #E1E1E1 solid;
  729. border-radius: 8rpx;
  730. }
  731. ::v-deep .u-number-box__minus {
  732. border-right: 2rpx #E1E1E1 solid;
  733. }
  734. ::v-deep .u-number-box__plus {
  735. border-left: 2rpx #E1E1E1 solid;
  736. }
  737. }
  738. .submitBar {
  739. position: fixed;
  740. bottom: calc(50px + env(safe-area-inset-bottom));
  741. background-color: #fff;
  742. width: 100%;
  743. z-index: 10;
  744. ::v-deep .u-checkbox__icon-wrap {
  745. border-color: #E75F37 !important;
  746. }
  747. .left-btn {
  748. background-color: #FFEEE9;
  749. color: #E75F37;
  750. font-size: 26rpx;
  751. width: 160rpx;
  752. height: 65rpx;
  753. display: flex;
  754. justify-content: center;
  755. align-items: center;
  756. border-top-left-radius: 33rpx;
  757. border-bottom-left-radius: 33rpx;
  758. }
  759. .right-btn {
  760. background-color: #E75F37;
  761. color: #fff;
  762. font-size: 26rpx;
  763. width: 160rpx;
  764. height: 65rpx;
  765. display: flex;
  766. justify-content: center;
  767. align-items: center;
  768. border-radius: 33rpx;
  769. }
  770. }
  771. </style>