confirmOrder.vue 12 KB

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