confirmCompanyOrder.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. <template>
  2. <view>
  3. <view class="inner-box">
  4. <!-- 药品列表 -->
  5. <view class="shopbox" v-for="(shop,idx) in carts" :key="idx">
  6. <view class="shopbox-name" v-if="shop.storeName && shop.storeName != 'null'">
  7. <!-- <label style="margin-right: 30upx;">
  8. <checkbox :value="shop.checked" :checked="chooseOrderKey == shop.createOrderKey" @click="choose(shop)" />
  9. </label> -->
  10. <text>{{shop.storeName}}</text>
  11. </view>
  12. <view class="goods-list">
  13. <view v-for="(item,index) in shop.list" :key="index" class="item" @click="showDetail(item)">
  14. <view class="img-box">
  15. <image :src="item.productAttrImage?item.productAttrImage:item.productImage" mode="aspectFill"></image>
  16. </view>
  17. <view class="info-box">
  18. <view>
  19. <view class="name-box ellipsis2">
  20. <view class="tag">{{utils.getDictLabelName("storeProductType",item.productType)}}</view>{{item.productName}}
  21. </view>
  22. <view class="spec ellipsis2">{{item.productAttrName}}</view>
  23. </view>
  24. <view class="price-num">
  25. <view class="price">
  26. <text class="unit">¥</text>
  27. <text class="num">{{item.price.toFixed(2)}}</text>
  28. </view>
  29. <view class="num">x{{item.cartNum}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 小计 -->
  34. <view class="sub-total">
  35. <view class="x-f">
  36. <text class="label">合计金额:</text>
  37. <view class="price">
  38. <text class="unit">¥</text>
  39. <text class="num">{{shop.totalMoney.toFixed(2)}}</text>
  40. </view>
  41. </view>
  42. <view class="x-f" style="margin-left: 20rpx;">
  43. <text class="label">实付金额:</text>
  44. <view class="price">
  45. <text class="unit">¥</text>
  46. <text class="num">{{shop.payMoney.toFixed(2)}}</text>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 底部按钮 -->
  54. <view class="btn-foot">
  55. <view class="right">
  56. <view class="total" >
  57. <text class="label">总金额:</text>
  58. <view class="price">
  59. <text class="unit">¥</text>
  60. <text class="num">{{price.totalPrice.toFixed(2)}}</text>
  61. </view>
  62. </view>
  63. <view class="btn" @click="openUpdateMoney()" >
  64. 实收金额
  65. </view>
  66. <view class="btn" >
  67. 分享
  68. <button class="share" data-name="shareBtn" open-type="share">分享</button>
  69. </view>
  70. </view>
  71. </view>
  72. <modal v-if="inputShow" title="实收金额" confirm-text="保存" cancel-text="取消" @cancel="cancelUpdateMoney" @confirm="confirmUpdateMoney">
  73. <view style="margin-bottom: 20rpx;color: #333;">选择店铺:</view>
  74. <view class="shopbox-pop">
  75. <view v-for="(shop,idx) in carts" :key="idx">
  76. <view class="shopbox-name" v-if="shop.storeName && shop.storeName != 'null'" style="margin-bottom: 20rpx;" @click="choose(shop,idx)">
  77. <label style="margin-right: 20upx;">
  78. <checkbox :value="shop.checked" :checked="chooseOrderKey == shop.createOrderKey"/>
  79. </label>
  80. <text>{{shop.storeName}}</text>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="rowbox x-f" :style="{visibility: chooseOrderKey ? 'visible':'hidden',color: '#333'}">店铺合计金额:¥{{carts[idx].totalMoney.toFixed(2)}}</view>
  85. <view class="rowbox x-f">
  86. <text style="margin-right: 20upx;color: #333;flex-shrink: 0;">实收金额</text>
  87. <input type="text" v-model="inputTxt" placeholder="请输入实收金额" class="intxt" maxlength="8" />
  88. </view>
  89. <!-- <view class="rowbox x-f">
  90. <text style="margin-right: 20upx;color: #333;flex-shrink: 0;">代收金额</text>
  91. <input type="text" v-model="inputTxt" placeholder="请输入代收金额" class="intxt" maxlength="8" />
  92. </view> -->
  93. </modal>
  94. </view>
  95. </template>
  96. <script>
  97. import {getSalesOrder,getSalesOrders,addUserCart,updateSalseOrderMoney,updateSaleOrderMoney} from '@/api/companyOrder.js'
  98. export default {
  99. data() {
  100. return {
  101. inputShow:false,
  102. inputTxt:null,
  103. orderKey:null,
  104. price:{
  105. payPrice:0.00,
  106. totalPrice:0.00,
  107. },
  108. carts:[],
  109. chooseOrderKey: '',
  110. idx: 0
  111. }
  112. },
  113. onLoad(option) {
  114. this.orderKey=option.orderKey;
  115. this.getSalesOrder();
  116. },
  117. //发送给朋友
  118. onShareAppMessage(res) {
  119. return {
  120. title: "壹柒玖康养集团-您的专属健康解决方案",
  121. path: '/pages_company/order/confirmOrder?orderKey='+this.orderKey,
  122. imageUrl: '/static/images/logo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  123. }
  124. },
  125. //分享到朋友圈
  126. onShareTimeline(res) {
  127. return {
  128. title:"壹柒玖康养集团-您的专属健康解决方案",
  129. query:'orderKey='+this.orderKey,
  130. imageUrl: '/static/images/logo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  131. }
  132. },
  133. methods: {
  134. choose(shop,idx) {
  135. this.chooseOrderKey = this.chooseOrderKey == shop.createOrderKey ? "" : shop.createOrderKey
  136. this.idx = this.chooseOrderKey ? idx : 0
  137. },
  138. openUpdateMoney(){
  139. this.chooseOrderKey = ""
  140. this.idx = 0
  141. this.inputTxt = null
  142. this.inputShow = true
  143. // if(this.chooseOrderKey) {
  144. // this.inputTxt = null
  145. // this.inputShow = true
  146. // } else {
  147. // uni.showToast({
  148. // title: "请先选择订单",
  149. // icon: "none"
  150. // })
  151. // }
  152. },
  153. cancelUpdateMoney(){
  154. this.chooseOrderKey = ""
  155. this.idx = 0
  156. this.inputShow = false
  157. },
  158. confirmUpdateMoney(){
  159. if(!this.chooseOrderKey) {
  160. uni.showToast({
  161. title: "请先选择订单",
  162. icon: "none"
  163. })
  164. return
  165. }
  166. if(parseFloat(this.inputTxt)>0){
  167. // var that=this;
  168. // var data={createOrderKey:this.chooseOrderKey,token:uni.getStorageSync('CompanyUserToken'),money:this.inputTxt}
  169. // updateSalseOrderMoney(data).then(
  170. // res => {
  171. // if(res.code==200){
  172. // this.chooseOrderKey = ""
  173. // this.inputShow = false
  174. // this.getSalesOrder();
  175. // }else{
  176. // uni.showToast({
  177. // icon:'none',
  178. // title: res.msg,
  179. // });
  180. // }
  181. // },
  182. // rej => {}
  183. // );
  184. // 多店铺修改实付金额
  185. const param = {
  186. token:uni.getStorageSync('CompanyUserToken'),
  187. vos: this.carts.map(item => ({
  188. createOrderKey: item.createOrderKey, // 购物车id
  189. totalPrice: item.totalMoney,//原价
  190. payPrice: item.createOrderKey == this.chooseOrderKey ? Number(this.inputTxt || 0) : item.payMoney//实收价
  191. }))
  192. }
  193. console.log(param)
  194. updateSaleOrderMoney(param).then(res => {
  195. if(res.code==200){
  196. this.chooseOrderKey = ""
  197. this.idx = 0
  198. this.inputShow = false
  199. this.getSalesOrder();
  200. }else{
  201. uni.showToast({
  202. icon:'none',
  203. title: res.msg,
  204. });
  205. }
  206. },
  207. rej => {}
  208. );
  209. }
  210. else{
  211. uni.showToast({
  212. icon:'none',
  213. title: "价格应大于0",
  214. });
  215. }
  216. },
  217. showDetail(item) {
  218. uni.navigateTo({
  219. url: 'productDetails?productId='+item.productId
  220. })
  221. },
  222. getSalesOrder(){
  223. var that=this;
  224. that.price.payPrice=0;
  225. that.price.totalPrice=0;
  226. var data={createOrderKeys:this.orderKey}
  227. getSalesOrders(data).then(
  228. res => {
  229. if(res.code==200){
  230. this.carts=res.carts;
  231. this.carts.forEach(function(element) {
  232. that.price.totalPrice += element.payMoney;
  233. // element.payPrice = 0
  234. // element.list.forEach(el=>{
  235. // element.payPrice += el.price * el.cartNum;
  236. // })
  237. });
  238. }else{
  239. uni.showToast({
  240. icon:'none',
  241. title: res.msg,
  242. });
  243. }
  244. },
  245. rej => {}
  246. );
  247. },
  248. }
  249. }
  250. </script>
  251. <style lang="scss">
  252. .intxt {
  253. border: 1rpx solid #eee;
  254. padding: 10rpx 20rpx;
  255. border-radius: 10rpx;
  256. }
  257. .rowbox {
  258. margin-bottom: 20rpx;
  259. }
  260. .shopbox-pop {
  261. max-height: 40vh;
  262. overflow-y: auto;
  263. box-sizing: border-box;
  264. margin-bottom: 30rpx;
  265. .shopbox-name {
  266. background-color: #fff;
  267. padding: 20rpx;
  268. border-radius: 10rpx;
  269. }
  270. }
  271. .inner-box{
  272. padding: 20upx 20upx 140upx;
  273. .shopbox {
  274. background-color: #FFFFFF;
  275. border-radius: 16upx;
  276. margin-bottom: 20upx;
  277. }
  278. .shopbox-name {
  279. padding: 30rpx 30rpx 0 30rpx;
  280. font-family: PingFang SC, PingFang SC;
  281. font-weight: 400;
  282. font-size: 30rpx;
  283. color: #111;
  284. overflow: hidden;
  285. white-space: nowrap;
  286. text-overflow: ellipsis;
  287. }
  288. .goods-list{
  289. // margin-top: 20upx;
  290. padding: 0 30upx;
  291. background-color: #FFFFFF;
  292. border-radius: 16upx;
  293. .item{
  294. padding: 30upx 0;
  295. border-bottom: 1px solid #EDEEEF;
  296. display: flex;
  297. align-items: center;
  298. .img-box{
  299. width: 160upx;
  300. height: 160upx;
  301. margin-right: 30upx;
  302. image{
  303. width: 100%;
  304. height: 100%;
  305. }
  306. }
  307. .info-box{
  308. width: calc(100% - 190upx);
  309. height: 160upx;
  310. display: flex;
  311. flex-direction: column;
  312. justify-content: space-between;
  313. .name-box{
  314. font-size: 28upx;
  315. font-family: PingFang SC;
  316. font-weight: 500;
  317. color: #111111;
  318. line-height: 40upx;
  319. .tag{
  320. display: inline-block;
  321. padding: 0 6upx;
  322. height: 30upx;
  323. background: linear-gradient(90deg, #66b2ef 0%, #0bb3f2 100%);
  324. border-radius: 4upx;
  325. margin-right: 10upx;
  326. font-size: 22upx;
  327. font-family: PingFang SC;
  328. font-weight: bold;
  329. color: #FFFFFF;
  330. line-height: 30upx;
  331. float: left;
  332. margin-top: 7upx;
  333. }
  334. }
  335. .spec{
  336. margin-top: 10upx;
  337. font-size: 24upx;
  338. font-family: PingFang SC;
  339. font-weight: 500;
  340. color: #999999;
  341. line-height: 1;
  342. }
  343. .price-num{
  344. display: flex;
  345. align-items: center;
  346. justify-content: space-between;
  347. .price{
  348. display: flex;
  349. align-items: flex-end;
  350. .unit{
  351. font-size: 24upx;
  352. font-family: PingFang SC;
  353. font-weight: 500;
  354. color: #111111;
  355. line-height: 1.2;
  356. margin-right: 4upx;
  357. }
  358. .num{
  359. font-size: 32upx;
  360. font-family: PingFang SC;
  361. font-weight: 500;
  362. color: #111111;
  363. line-height: 1;
  364. }
  365. }
  366. .num{
  367. font-size: 24upx;
  368. font-family: PingFang SC;
  369. font-weight: 500;
  370. color: #999999;
  371. line-height: 1;
  372. }
  373. }
  374. }
  375. }
  376. .sub-total{
  377. height: 88upx;
  378. display: flex;
  379. align-items: center;
  380. justify-content: flex-end;
  381. .label{
  382. font-size: 24upx;
  383. font-family: PingFang SC;
  384. font-weight: 500;
  385. color: #999999;
  386. }
  387. .price{
  388. display: flex;
  389. align-items: flex-end;
  390. .unit{
  391. font-size: 24upx;
  392. font-family: PingFang SC;
  393. font-weight: 500;
  394. color: #FF6633;
  395. line-height: 1.2;
  396. margin-right: 4upx;
  397. }
  398. .num{
  399. font-size: 32upx;
  400. font-family: PingFang SC;
  401. font-weight: bold;
  402. color: #FF6633;
  403. line-height: 1;
  404. }
  405. }
  406. }
  407. }
  408. .points{
  409. height: 88upx;
  410. padding: 0 30upx;
  411. background: #FFFFFF;
  412. border-radius: 16upx;
  413. display: flex;
  414. align-items: center;
  415. justify-content: space-between;
  416. .left{
  417. display: flex;
  418. align-items: center;
  419. image{
  420. width: 28upx;
  421. height: 28upx;
  422. margin-right: 20upx;
  423. }
  424. .text{
  425. font-size: 28upx;
  426. font-family: PingFang SC;
  427. font-weight: 500;
  428. color: #666666;
  429. }
  430. }
  431. .right{
  432. display: flex;
  433. align-items: center;
  434. .text{
  435. font-size: 28upx;
  436. font-family: PingFang SC;
  437. font-weight: 500;
  438. color: #111111;
  439. }
  440. image{
  441. margin-left: 15upx;
  442. width: 14upx;
  443. height: 24upx;
  444. }
  445. }
  446. }
  447. .remarks{
  448. height: 88upx;
  449. padding: 0 30upx;
  450. background: #FFFFFF;
  451. border-radius: 16upx;
  452. margin-top: 20upx;
  453. display: flex;
  454. align-items: center;
  455. input{
  456. width: 100%;
  457. font-size: 28upx;
  458. font-family: PingFang SC;
  459. font-weight: 500;
  460. color: #000000;
  461. }
  462. .input{
  463. font-size: 28upx;
  464. font-family: PingFang SC;
  465. font-weight: 500;
  466. color: #999999;
  467. }
  468. }
  469. }
  470. .btn-foot{
  471. box-sizing: border-box;
  472. width: 100%;
  473. height: 121upx;
  474. background: #FFFFFF;
  475. padding: 16upx 30upx;
  476. display: flex;
  477. align-items: center;
  478. justify-content: flex-end;
  479. position: fixed;
  480. left: 0;
  481. bottom: 0;
  482. z-index: 99;
  483. .right{
  484. display: flex;
  485. align-items: center;
  486. .total{
  487. display: flex;
  488. align-items: flex-end;
  489. margin-right: 15upx;
  490. .label{
  491. font-size: 26upx;
  492. font-family: PingFang SC;
  493. font-weight: 500;
  494. color: #999999;
  495. line-height: 1.5;
  496. }
  497. .price{
  498. display: flex;
  499. align-items: flex-end;
  500. .unit{
  501. font-size: 28upx;
  502. font-family: PingFang SC;
  503. font-weight: bold;
  504. color: #FF6633;
  505. line-height: 1.2;
  506. margin-right: 10upx;
  507. }
  508. .num{
  509. font-size: 32upx;
  510. font-family: PingFang SC;
  511. font-weight: bold;
  512. color: #FF6633;
  513. line-height: 1;
  514. }
  515. }
  516. }
  517. .btn{
  518. margin-left: 10rpx;
  519. width: 180upx;
  520. height: 88upx;
  521. line-height: 88upx;
  522. text-align: center;
  523. font-size: 30upx;
  524. font-family: PingFang SC;
  525. font-weight: bold;
  526. color: #FFFFFF;
  527. background: #0bb3f2;
  528. border-radius: 44upx;
  529. position: relative;
  530. .share{
  531. display: inline-block;
  532. position: absolute;
  533. top: 0;
  534. left: 0;
  535. width: 100%;
  536. height: 100%rpx;
  537. opacity: 0;
  538. }
  539. }
  540. }
  541. }
  542. </style>