confirmOrder.vue 12 KB

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