confirmOrder.vue 11 KB

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