shoppingCart.vue 22 KB

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