confirmOrder.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <template>
  2. <view>
  3. <view class="inner-box">
  4. <!-- 药品列表 -->
  5. <view class="goods-list">
  6. <view v-for="(item,index) in carts" :key="index" class="item" @click="showDetail(item)">
  7. <view class="img-box">
  8. <image :src="item.productImage" mode="aspectFill"></image>
  9. </view>
  10. <view class="info-box">
  11. <view>
  12. <view class="name-box ellipsis2">
  13. <view class="myotctxt" style="margin-right: 10rpx;" :style="{background:_background(item.productType)}">{{$getDictLabelName("storeProductType",item.productType)}}</view>{{ item.commonName&&item.commonName!=='-'?item.commonName:item.productName }}
  14. </view>
  15. <view class="spec ellipsis2">{{item.productAttrName}}</view>
  16. </view>
  17. <view class="price-num">
  18. <view class="price">
  19. <text class="unit">¥</text>
  20. <text class="num">{{item.price.toFixed(2)}}</text>
  21. </view>
  22. <view class="num">x{{item.cartNum}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 小计 -->
  27. <view class="sub-total">
  28. <text class="label">订单金额:</text>
  29. <view class="price">
  30. <text class="unit">¥</text>
  31. <text class="num">{{price.totalPrice.toFixed(2)}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 底部按钮 -->
  37. <view class="btn-foot">
  38. <view class="right">
  39. <view class="total">
  40. <text class="label">实付金额:</text>
  41. <view class="price">
  42. <text class="unit">¥</text>
  43. <text class="num">{{price.payPrice.toFixed(2)}}</text>
  44. </view>
  45. </view>
  46. <view class="btn" @click="submitOrder">支付{{price.payPrice.toFixed(2)}}</view>
  47. </view>
  48. </view>
  49. <view class="message-box" v-if="messageShow">
  50. <view class="left">
  51. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/images/close24.png" mode="" @click="closeOrder()" ></image>
  52. <view class="text ellipsis">您有{{count0}}个待支付订单</view>
  53. </view>
  54. <view class="btn" @click="showOrder()">查看</view>
  55. </view>
  56. <!-- <ykscreenRecord></ykscreenRecord> -->
  57. </view>
  58. </template>
  59. <script>
  60. import {getOrderCount} from '@/api/myStoreOrder.js'
  61. import {getSalesOrder,getSalesOrders,addUserCart} from '../api/companyOrder.js'
  62. // import ykscreenRecord from "@/components/yk-screenRecord/yk-screenRecord.vue"
  63. export default {
  64. // components: {
  65. // ykscreenRecord
  66. // },
  67. data() {
  68. return {
  69. count0:0,
  70. messageShow:false,
  71. orderKey:null,
  72. price:{
  73. totalPrice:0.00,
  74. payPrice:0.00,
  75. },
  76. carts:[],
  77. address: null,
  78. companyUserId: null,
  79. dataKey: '',
  80. dataPrescribeKey:''
  81. }
  82. },
  83. computed: {
  84. _background() {
  85. //productType: 1:OTC,2:Rx,3:非药品,4:器械
  86. return (productType)=> {
  87. switch (productType) {
  88. case 1: return '#37E2EA' // OTC
  89. case 2: return 'red' // Rx
  90. case 3: return '#2583EB' // 非药品
  91. case 4: return '#999' // 器械
  92. default: return '#ccc'
  93. }
  94. }
  95. }
  96. },
  97. onLoad(option) {
  98. console.log("qxj option:"+JSON.stringify(option));
  99. this.orderKey=option.orderKey||'';
  100. this.dataPrescribeKey = option.dataPrescribeKey||'';
  101. this.dataKey=option.dataKey;
  102. this.companyUserId=option.companyUserId;
  103. },
  104. onShow() {
  105. this.$isLogin().then(res => {
  106. if(res){
  107. this.getOrderCount();
  108. }
  109. })
  110. this.getSalesOrder();
  111. },
  112. methods: {
  113. showOrder(){
  114. this.$isLogin().then(res => {
  115. if(res){
  116. uni.navigateTo({
  117. url: '/pages_user/shopping/storeOrder?status=0'
  118. })
  119. }
  120. })
  121. },
  122. closeOrder(){
  123. this.messageShow=false;
  124. },
  125. getOrderCount(){
  126. getOrderCount().then(
  127. res => {
  128. if(res.code==200){
  129. this.count0=res.count0;
  130. if(this.count0>0){
  131. this.messageShow=true;
  132. }
  133. }
  134. },
  135. rej => {}
  136. );
  137. },
  138. showDetail(item) {
  139. uni.navigateTo({
  140. url: './productShowDetails?productId='+item.productId
  141. })
  142. },
  143. getSalesOrder(item){
  144. var that=this;
  145. var data={createOrderKey:this.orderKey}
  146. getSalesOrder(data).then(
  147. res => {
  148. if(res.code==200){
  149. this.carts=res.carts;
  150. this.carts.forEach(function(element) {
  151. // that.price.payPrice += element.payMoney;
  152. that.price.totalPrice+=element.price*element.cartNum;
  153. });
  154. that.price.payPrice=res.totalMoney
  155. }else{
  156. uni.showToast({
  157. icon:'none',
  158. title: res.msg,
  159. });
  160. }
  161. },
  162. rej => {}
  163. );
  164. },
  165. // 提交订单
  166. submitOrder() {
  167. this.$isLogin().then(res => {
  168. if(res){
  169. var data={createOrderKey:this.orderKey}
  170. addUserCart(data).then(
  171. res => {
  172. if(res.code==200){
  173. const confirmParam = res.carts.map((item,i)=>({
  174. storeId: item.storeId,
  175. data: {
  176. type: "buy",
  177. cartIds: item.cartQueryList.map(it => it.id).join(",")
  178. }
  179. }))
  180. const companyId = res.companyId ||''
  181. const companyUserId = res.companyUserId ||''
  182. uni.navigateTo({
  183. url: '/pages_shopping/confirmCreateOrder?companyId='+companyId+"&companyUserId="+companyUserId+"&dataKey="+this.dataKey+"&dataPrescribeKey="+this.dataPrescribeKey+"&createOrderKey="+this.orderKey +'&confirmParam='+encodeURIComponent(JSON.stringify(confirmParam))
  184. })
  185. // uni.navigateTo({
  186. // url: '/pages_shopping/confirmCreateOrder?type=buy&cartIds='+res.cartIds.toString()+"&companyId="+res.companyId+"&companyUserId="+res.companyUserId+"&createOrderKey="+this.orderKey
  187. // })
  188. }else{
  189. uni.showToast({
  190. icon:'none',
  191. title: res.msg,
  192. });
  193. }
  194. },
  195. rej => {}
  196. );
  197. //将购物车产品更新为自己的购物车
  198. }
  199. })
  200. },
  201. }
  202. }
  203. </script>
  204. <style lang="scss" lang="scss">
  205. .inner-box{
  206. padding: 20upx 20upx 140upx;
  207. .goods-list{
  208. margin-top: 20upx;
  209. padding: 0 30upx;
  210. background-color: #FFFFFF;
  211. border-radius: 16upx;
  212. .item{
  213. padding: 30upx 0;
  214. border-bottom: 1px solid #EDEEEF;
  215. display: flex;
  216. align-items: center;
  217. .img-box{
  218. width: 160upx;
  219. height: 160upx;
  220. margin-right: 30upx;
  221. image{
  222. width: 100%;
  223. height: 100%;
  224. }
  225. }
  226. .info-box{
  227. width: calc(100% - 190upx);
  228. height: 160upx;
  229. display: flex;
  230. flex-direction: column;
  231. justify-content: space-between;
  232. .name-box{
  233. font-size: 28upx;
  234. font-family: PingFang SC;
  235. font-weight: 500;
  236. color: #111111;
  237. line-height: 40upx;
  238. .tag{
  239. display: inline-block;
  240. padding: 0 6upx;
  241. height: 30upx;
  242. background: linear-gradient(90deg, #66b2ef 0%, #2583EB 100%);
  243. border-radius: 4upx;
  244. margin-right: 10upx;
  245. font-size: 22upx;
  246. font-family: PingFang SC;
  247. font-weight: bold;
  248. color: #FFFFFF;
  249. line-height: 30upx;
  250. float: left;
  251. margin-top: 7upx;
  252. }
  253. }
  254. .spec{
  255. margin-top: 10upx;
  256. font-size: 24upx;
  257. font-family: PingFang SC;
  258. font-weight: 500;
  259. color: #999999;
  260. line-height: 1;
  261. }
  262. .price-num{
  263. display: flex;
  264. align-items: center;
  265. justify-content: space-between;
  266. .price{
  267. display: flex;
  268. align-items: flex-end;
  269. .unit{
  270. font-size: 24upx;
  271. font-family: PingFang SC;
  272. font-weight: 500;
  273. color: #111111;
  274. line-height: 1.2;
  275. margin-right: 4upx;
  276. }
  277. .num{
  278. font-size: 32upx;
  279. font-family: PingFang SC;
  280. font-weight: 500;
  281. color: #111111;
  282. line-height: 1;
  283. }
  284. }
  285. .num{
  286. font-size: 24upx;
  287. font-family: PingFang SC;
  288. font-weight: 500;
  289. color: #999999;
  290. line-height: 1;
  291. }
  292. }
  293. }
  294. }
  295. .sub-total{
  296. height: 88upx;
  297. display: flex;
  298. align-items: center;
  299. justify-content: flex-end;
  300. .label{
  301. font-size: 24upx;
  302. font-family: PingFang SC;
  303. font-weight: 500;
  304. color: #999999;
  305. }
  306. .price{
  307. display: flex;
  308. align-items: flex-end;
  309. .unit{
  310. font-size: 24upx;
  311. font-family: PingFang SC;
  312. font-weight: 500;
  313. color: #FF6633;
  314. line-height: 1.2;
  315. margin-right: 4upx;
  316. }
  317. .num{
  318. font-size: 32upx;
  319. font-family: PingFang SC;
  320. font-weight: bold;
  321. color: #FF6633;
  322. line-height: 1;
  323. }
  324. }
  325. }
  326. }
  327. .points{
  328. height: 88upx;
  329. padding: 0 30upx;
  330. background: #FFFFFF;
  331. border-radius: 16upx;
  332. display: flex;
  333. align-items: center;
  334. justify-content: space-between;
  335. .left{
  336. display: flex;
  337. align-items: center;
  338. image{
  339. width: 28upx;
  340. height: 28upx;
  341. margin-right: 20upx;
  342. }
  343. .text{
  344. font-size: 28upx;
  345. font-family: PingFang SC;
  346. font-weight: 500;
  347. color: #666666;
  348. }
  349. }
  350. .right{
  351. display: flex;
  352. align-items: center;
  353. .text{
  354. font-size: 28upx;
  355. font-family: PingFang SC;
  356. font-weight: 500;
  357. color: #111111;
  358. }
  359. image{
  360. margin-left: 15upx;
  361. width: 14upx;
  362. height: 24upx;
  363. }
  364. }
  365. }
  366. .remarks{
  367. height: 88upx;
  368. padding: 0 30upx;
  369. background: #FFFFFF;
  370. border-radius: 16upx;
  371. margin-top: 20upx;
  372. display: flex;
  373. align-items: center;
  374. input{
  375. width: 100%;
  376. font-size: 28upx;
  377. font-family: PingFang SC;
  378. font-weight: 500;
  379. color: #000000;
  380. }
  381. .input{
  382. font-size: 28upx;
  383. font-family: PingFang SC;
  384. font-weight: 500;
  385. color: #999999;
  386. }
  387. }
  388. }
  389. .btn-foot{
  390. box-sizing: border-box;
  391. width: 100%;
  392. height: 121upx;
  393. background: #FFFFFF;
  394. display: flex;
  395. align-items: center;
  396. justify-content: flex-end;
  397. position: fixed;
  398. left: 0;
  399. bottom: 0;
  400. z-index: 99;
  401. .right{
  402. display: flex;
  403. align-items: center;
  404. .total{
  405. display: flex;
  406. align-items: flex-end;
  407. margin-right: 15upx;
  408. .label{
  409. font-size: 26upx;
  410. font-family: PingFang SC;
  411. font-weight: 500;
  412. color: #999999;
  413. line-height: 1.5;
  414. }
  415. .price{
  416. display: flex;
  417. align-items: flex-end;
  418. .unit{
  419. font-size: 26upx;
  420. font-family: PingFang SC;
  421. font-weight: bold;
  422. color: #FF6633;
  423. line-height: 1.2;
  424. margin-right: 10upx;
  425. }
  426. .num{
  427. font-size: 32upx;
  428. font-family: PingFang SC;
  429. font-weight: bold;
  430. color: #FF6633;
  431. line-height: 1;
  432. }
  433. }
  434. }
  435. .btn{
  436. margin-right: 15upx;
  437. padding: 20rpx 30rpx;
  438. text-align: center;
  439. font-size: 30upx;
  440. font-family: PingFang SC;
  441. font-weight: bold;
  442. color: #FFFFFF;
  443. background: #2583EB;
  444. border-radius: 44upx;
  445. }
  446. }
  447. }
  448. </style>
  449. <style lang="less" scoped>
  450. .coupon {
  451. height: 100%;
  452. }
  453. /*优惠券列表公共*/
  454. .coupon-list {
  455. }
  456. .coupon-list .item {
  457. display: flex;
  458. flex-direction: column;
  459. justify-content: center;
  460. align-items: center;
  461. width: 100%;
  462. height: 1.7 * 100rpx;
  463. margin-bottom: 0.16 * 100rpx;
  464. }
  465. .coupon-list .item .money {
  466. background-size: 100% 100%;
  467. width: 2.4 * 100rpx;
  468. height: 100%;
  469. color: #fff;
  470. font-size: 0.36 * 100rpx;
  471. font-weight: bold;
  472. text-align: center;
  473. display: flex;
  474. flex-direction: column;
  475. align-items: center;
  476. justify-content: center;
  477. position: relative;
  478. }
  479. .coupon-list .item .money .img{
  480. position: absolute;
  481. width: 2.4 * 100rpx;
  482. height: 100%;
  483. color: #fff;
  484. }
  485. .coupon-list .item .money .num {
  486. font-size: 0.6 * 100rpx;
  487. }
  488. .coupon-list .item .money .pic-num {
  489. font-size: 20rpx;
  490. z-index: 99;
  491. }
  492. .coupon-list .item .text {
  493. width: 4.5 * 100rpx;
  494. padding: 0 0.17 * 100rpx 0 0.24 * 100rpx;
  495. background-color: #fff;
  496. box-sizing: border-box;
  497. }
  498. .coupon-list .item .text .condition {
  499. font-size: 0.3 * 100rpx;
  500. color: #282828;
  501. height: 0.93 * 100rpx;
  502. line-height: 0.93 * 100rpx;
  503. border-bottom: 1px solid #f0f0f0;
  504. }
  505. .coupon-list .item .text .data {
  506. font-size: 0.2 * 100rpx;
  507. color: #999;
  508. height: 0.76 * 100rpx;
  509. }
  510. .coupon-list .item .text .data .bnt {
  511. width: 1.36 * 100rpx;
  512. height: 0.44 * 100rpx;
  513. border-radius: 0.22 * 100rpx;
  514. font-size: 0.22 * 100rpx;
  515. color: #fff;
  516. text-align: center;
  517. line-height: 0.44 * 100rpx;
  518. background-color: red;
  519. }
  520. .coupon-list .item .text .data .bnt.gray {
  521. background-color: #ccc;
  522. }
  523. .message-box{
  524. box-sizing: border-box;
  525. width: 693upx;
  526. height: 84upx;
  527. background: #F3FFFD;
  528. border: 1px solid #C7E9E5;
  529. box-shadow: 0px 4upx 12upx 0px rgba(90, 203, 138, 0.16);
  530. border-radius: 16upx;
  531. position: fixed;
  532. left: 50%;
  533. transform: translateX(-50%);
  534. bottom: 128upx;
  535. z-index: 99;
  536. display: flex;
  537. align-items: center;
  538. justify-content: space-between;
  539. padding: 0 20upx 0 30upx;
  540. .left{
  541. width: 80%;
  542. display: flex;
  543. align-items: center;
  544. image{
  545. width: 24upx;
  546. height: 24upx;
  547. margin-right: 18upx;
  548. }
  549. .text{
  550. width: 90%;
  551. font-size: 28upx;
  552. font-family: PingFang SC;
  553. font-weight: 500;
  554. color: #2583EB;
  555. }
  556. }
  557. .btn{
  558. width: 100upx;
  559. height: 48upx;
  560. line-height: 48upx;
  561. text-align: center;
  562. font-size: 24upx;
  563. font-family: PingFang SC;
  564. font-weight: 500;
  565. color: #FFFFFF;
  566. border: 1px solid #D2E6FF;
  567. background: linear-gradient(135deg, #66b2ef 0%, #2583EB 100%);
  568. border-radius: 24upx;
  569. margin-left: 30upx;
  570. }
  571. }
  572. </style>