confirmOrder.vue 12 KB

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