confirmOrder.vue 12 KB

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