confirmOrder.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <template>
  2. <view class="bg">
  3. <view class="address" >
  4. <view>
  5. <u--image width="40rpx" height="40rpx" src="/static/market/icomm_dizhi.png" ></u--image>
  6. </view>
  7. <view class="address_text">
  8. <view class="flex_start">
  9. <view v-if="orderDetailData.defaultAddress=='1'" class="mr">默认</view>
  10. <!-- <view class="mr1">{{orderDetailData.deliveryAddress}}</view> -->
  11. </view>
  12. <view class="address_conter">
  13. {{orderDetailData.deliveryAddress}}
  14. </view>
  15. <view class="flex_start address_bottom" >
  16. <view>{{orderDetailData.consignee}}</view>
  17. <view style="margin-left:8rpx">{{orderDetailData.contact}}</view>
  18. </view>
  19. </view>
  20. <view @click="openaddress">
  21. <u--image width="40rpx" height="40rpx" src="/static/myinfo/btn_right.png" ></u--image>
  22. </view>
  23. </view>
  24. <view class="commodity">
  25. <view class="commodity_title">厦门海嘉成商城</view>
  26. <view class="mc_item" v-for="(item,index) in orderDetailData.detailVoList" :key="index">
  27. <view class="item_swipe">
  28. <view class="box_img">
  29. <u--image radius='16rpx' width="180rpx" height="180rpx" :src="item.fileList[0].fileUrl" ></u--image>
  30. </view>
  31. <view class="box_text">
  32. <view class="box_title">
  33. {{ item.productTitle }}
  34. </view>
  35. <view class="box_type">
  36. 已选择 {{item.specsName}}
  37. </view>
  38. <view class="box_num">
  39. <view class="bn_left">
  40. ¥{{item.price}}
  41. </view>
  42. <view class="bn_right">
  43. {{ 'x' + item.num }}
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view style="margin-left: 12px;margin-bottom: 12px;" class="PriceInfo_item">
  50. <view>备注</view>
  51. <view @click="openPopup()" style="color: #999999;display: flex;">
  52. <view class="beizhu">{{ remark == ''?'备注留言信息':remark }}</view>
  53. <u--image width="40rpx" height="40rpx" src="/static/myinfo/btn_right.png" ></u--image>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="PriceInfo">
  58. <view class="PriceInfo_title">费用明细</view>
  59. <view class="PriceInfo_item">
  60. <view>商品总额</view>
  61. <view>¥ {{orderDetailData.productPrice}}</view>
  62. </view>
  63. <view class="PriceInfo_item">
  64. <view>加工费用</view>
  65. <view>¥ {{orderDetailData.processPrice}}</view>
  66. </view>
  67. <view class="PriceInfo_item">
  68. <view>包装袋费</view>
  69. <view>¥ {{orderDetailData.packagePrice}}</view>
  70. </view>
  71. <!-- <view class="PriceInfo_item">
  72. <view>优惠券</view>
  73. <view>¥ {{item.price}}</view>
  74. </view> -->
  75. <view class="PriceInfo_item">
  76. <view>总价</view>
  77. <view style="color: #F6514F;font-weight: bold;font-size: 28rpx;">¥ {{orderDetailData.totalPrice}}</view>
  78. </view>
  79. </view>
  80. <u-popup mode="center" :round="10" :show="popupShow" @close="close" @open="open">
  81. <view style="width: 700rpx;height: 300rpx;padding: 20rpx;">
  82. <view>
  83. <u-form-item :labelWidth="labelWidth" label="备注信息" borderBottom >
  84. <u--textarea v-model="beizhu" placeholder="请输入备注信息"
  85. count maxlength="200" ></u--textarea>
  86. </u-form-item>
  87. </view>
  88. <view style="display: flex;
  89. justify-content: center;
  90. margin-top: 10rpx;">
  91. <view @click="submitbeizhu" class="bm_btn2">
  92. 保存
  93. </view>
  94. </view>
  95. </view>
  96. </u-popup>
  97. <view style="height: 200rpx;">
  98. </view>
  99. <view class="btnBox" >
  100. <view class="bm_btn">
  101. <view @click="cancelOrder" class="bm_btn1">取消订单</view>
  102. <view @click="submitOrder" class="bm_btn2">提交订单</view>
  103. </view>
  104. </view>
  105. </view>
  106. </template>
  107. <script>
  108. import {orderDetail,cancelOrderByConfirm,
  109. confirmOrder,deliveryAddressList,prePayOrder,
  110. payPaying} from '@/http/api/common.js'
  111. import * as util from '@/pages/util/util.js'
  112. export default {
  113. components: {
  114. },
  115. data() {
  116. return {
  117. orderDetailData:{
  118. deliveryAddress:'',
  119. deliveryAddressId:'',
  120. defaultAddress:'',
  121. consignee:'',
  122. contact:'',
  123. detailVoList:[],//订单列表
  124. },
  125. beizhu:'',
  126. remark:'',
  127. labelWidth:100,
  128. popupShow:false,
  129. AddressData:{}
  130. }
  131. },
  132. async onLoad(e) {
  133. if (e?.orderId) {
  134. await this.getOrderDetail(e?.orderId)
  135. }
  136. },
  137. onShow(){
  138. let selectAddress = uni.getStorageSync('selectAddress');
  139. if (selectAddress) {
  140. selectAddress = JSON.parse(selectAddress)
  141. this.orderDetailData.deliveryAddress = selectAddress.address
  142. this.orderDetailData.defaultAddress = selectAddress.defaultAddress
  143. this.orderDetailData.deliveryAddressId = selectAddress.id
  144. }
  145. },
  146. methods: {
  147. async getdeliveryAddressList(){
  148. let res = await deliveryAddressList()
  149. if (res.data.code == 200) {
  150. if (res.data.data) {
  151. this.AddressData = res.data.data.find(v=>v.defaultAddress == '1')
  152. }
  153. }
  154. },
  155. openPopup() {
  156. this.popupShow = true
  157. },
  158. open() {
  159. },
  160. submitbeizhu(){
  161. this.close()
  162. this.remark = this.beizhu
  163. },
  164. close() {
  165. this.popupShow = false
  166. // console.log('close');
  167. },
  168. async getOrderDetail(id){
  169. let res = await orderDetail(id)
  170. if (res.data.code ==200) {
  171. this.orderDetailData = res.data.data
  172. }
  173. },
  174. async cancelOrder(){
  175. //取消订单
  176. let res = await cancelOrderByConfirm(this.orderDetailData.id)
  177. util.toastFunc('取消成功',()=>{
  178. uni.switchTab({
  179. url: '/pages/market/market',
  180. });
  181. })
  182. },
  183. async submitOrder(){
  184. //提交订单
  185. let res = await confirmOrder({
  186. remark:this.remark,
  187. deliveryAddressId:this.orderDetailData.deliveryAddressId,
  188. },this.orderDetailData.id)
  189. if (res.data.code == 200) {
  190. let Payres = await prePayOrder(this.orderDetailData.id)
  191. let PaymentData = Payres.data.data
  192. console.log('PaymentData',PaymentData);
  193. const that = this;
  194. // 调用微信支付
  195. uni.requestPayment({
  196. provider: 'wxpay',
  197. timeStamp: PaymentData.timeStamp,
  198. nonceStr: PaymentData.nonceStr,
  199. package: PaymentData.packageVal,
  200. signType: PaymentData.signType,
  201. paySign: PaymentData.paySign,
  202. appId: PaymentData.appId,
  203. success(res) {
  204. uni.showLoading({
  205. title: '确认支付状态中...'
  206. });
  207. that.ConfirmPaymentStatus()
  208. },
  209. fail(err) {
  210. console.log('支付失败', err)
  211. uni.showToast({
  212. icon: 'none',
  213. title: '支付失败',
  214. })
  215. }
  216. })
  217. }
  218. },
  219. async ConfirmPaymentStatus(){
  220. //确认支付状态
  221. let res = await payPaying(this.orderDetailData.id)
  222. uni.hideLoading()
  223. if (res.data.code == 200) {
  224. util.toastFunc('支付成功',()=>{
  225. uni.switchTab({
  226. url: '/pages/market/market',
  227. });
  228. })
  229. }else{
  230. util.toastFunc(res.data.msg)
  231. }
  232. },
  233. openaddress(){
  234. uni.navigateTo({
  235. url: '/pages/myinfo/address?selectAddress=1'
  236. });
  237. },
  238. createUuid() {
  239. function S4() {
  240. return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  241. }
  242. return (S4() + S4() + S4() + S4() + S4() + S4() + S4() + S4());
  243. },
  244. }
  245. }
  246. </script>
  247. <style>
  248. .bg{
  249. width: 750rpx;
  250. height: 100vh;
  251. min-height: 1160rpx;
  252. background: #F1F1F1;
  253. border-radius: 0rpx 0rpx 0rpx 0rpx;
  254. display: flex;
  255. flex-direction: column;
  256. align-items: center;
  257. }
  258. .address{
  259. width: 702rpx;
  260. height: 200rpx;
  261. background: #FFFFFF;
  262. border-radius: 16rpx 16rpx 16rpx 16rpx;
  263. opacity: 1;
  264. margin-top: 24rpx;
  265. display: flex;
  266. flex-direction: row;
  267. align-items: center;
  268. justify-content: space-evenly;
  269. }
  270. .commodity{
  271. width: 702rpx;
  272. height: auto;
  273. background: #FFFFFF;
  274. border-radius: 16rpx 16rpx 16rpx 16rpx;
  275. opacity: 1;
  276. margin-top: 24rpx;
  277. }
  278. .PriceInfo{
  279. width: 702rpx;
  280. height: 400rpx;
  281. background: #FFFFFF;
  282. border-radius: 16rpx 16rpx 16rpx 16rpx;
  283. opacity: 1;
  284. margin-top: 24rpx;
  285. display: flex;
  286. align-items: center;
  287. justify-content: space-evenly;
  288. flex-direction: column;
  289. }
  290. .PriceInfo_item{
  291. display: flex;
  292. justify-content: space-between;
  293. width: 654rpx;
  294. height: 40rpx;
  295. font-size: 28rpx;
  296. font-weight: 500;
  297. color: #666666;
  298. line-height: 36rpx;
  299. }
  300. .PriceInfo_title{
  301. display: flex;
  302. width: 654rpx;
  303. height: 40rpx;
  304. font-size: 32rpx;
  305. font-weight: bold;
  306. color: #333333;
  307. line-height: 36rpx;
  308. margin: 20rpx 0;
  309. }
  310. .btnBox{
  311. width: 750rpx;
  312. height: 100rpx;
  313. background: #FFFFFF;
  314. border-radius: 0rpx 0rpx 0rpx 0rpx;
  315. opacity: 1;
  316. position: fixed;
  317. z-index: 10088;
  318. bottom: 0;
  319. display: flex;
  320. flex-direction: row;
  321. align-items: center;
  322. justify-content: flex-end;
  323. }
  324. .bm_btn{
  325. display: flex;
  326. flex-direction: row;
  327. align-items: center;
  328. width: 450rpx;
  329. height: 72rpx;
  330. justify-content: space-evenly;
  331. }
  332. .bm_btn1{
  333. width: 200rpx;
  334. height: 72rpx;
  335. background: #EEEEEE;
  336. border-radius: 60rpx 60rpx 60rpx 60rpx;
  337. opacity: 1;
  338. font-size: 28rpx;
  339. font-weight: 500;
  340. color: #666;
  341. line-height: 72rpx;
  342. text-align: center;
  343. }
  344. .bm_btn2{
  345. width: 200rpx;
  346. height: 72rpx;
  347. background: #46A6FF;
  348. border-radius: 60rpx 60rpx 60rpx 60rpx;
  349. opacity: 1;
  350. font-size: 28rpx;
  351. font-weight: 500;
  352. color: #FFFFFF;
  353. line-height: 72rpx;
  354. text-align: center;
  355. }
  356. .flex_start{
  357. display: flex;
  358. justify-content: flex-start;
  359. align-items: center;
  360. }
  361. .mr{
  362. width: 64rpx;
  363. height: 32rpx;
  364. background: #FF8C33;
  365. border-radius: 8rpx 8rpx 8rpx 8rpx;
  366. opacity: 1;
  367. font-size: 24rpx;
  368. font-weight: 500;
  369. color: #FFFFFF;
  370. text-align: center;
  371. }
  372. .mr1{
  373. width: 440rpx;
  374. margin-left: 8rpx;
  375. font-size: 28rpx;
  376. font-weight: 500;
  377. color: #333333;
  378. }
  379. .commodity_title{
  380. width: 196rpx;
  381. height: 40rpx;
  382. font-size: 28rpx;
  383. font-weight: bold;
  384. color: #333333;
  385. line-height: 40rpx;
  386. padding: 24rpx 0 0 24rpx;
  387. }
  388. .address_text{
  389. width: 550rpx;
  390. height: 200rpx;
  391. display: flex;
  392. flex-direction: column;
  393. justify-content: center;
  394. }
  395. .address_conter{
  396. width: 550rpx;
  397. height: 45rpx;
  398. font-size: 32rpx;
  399. font-weight: bold;
  400. color: #333333;
  401. line-height: 45rpx;
  402. margin-top: 8rpx;
  403. display: -webkit-box;
  404. word-break: break-all;
  405. text-overflow: ellipsis;
  406. overflow: hidden;
  407. -webkit-box-orient: vertical;
  408. -webkit-line-clamp:1;
  409. }
  410. .address_bottom{
  411. width: 550rpx;
  412. height: 40rpx;
  413. font-size: 28rpx;
  414. font-weight: bold;
  415. color: #999999;
  416. margin-top: 8rpx;
  417. }
  418. .mc_item{
  419. width: 702rpx;
  420. height: 244rpx;
  421. background: #FFFFFF;
  422. border-radius: 16rpx 16rpx 16rpx 16rpx;
  423. opacity: 1;
  424. margin-top: 24rpx;
  425. }
  426. .item_swipe{
  427. width: 678rpx;
  428. height: 244rpx;
  429. background: #FFFFFF;
  430. border-radius: 16rpx 16rpx 16rpx 16rpx;
  431. opacity: 1;
  432. display: flex;
  433. align-items: center;
  434. flex-direction: row;
  435. padding-left: 24rpx;
  436. }
  437. .box_img{
  438. width: 180rpx;
  439. height: 180rpx;
  440. background-color: #999999;
  441. border-radius: 16rpx;
  442. }
  443. .box_text{
  444. width: 392rpx;
  445. height: 200rpx;
  446. margin-left: 20rpx;
  447. display: flex;
  448. flex-direction: column;
  449. justify-content: space-between;
  450. }
  451. .box_title{
  452. width: 392rpx;
  453. height: 40rpx;
  454. font-size: 28rpx;
  455. font-weight: bold;
  456. color: #333333;
  457. line-height: 40rpx;
  458. display: -webkit-box;
  459. word-break: break-all;
  460. text-overflow: ellipsis;
  461. overflow: hidden;
  462. -webkit-box-orient: vertical;
  463. -webkit-line-clamp:1;
  464. }
  465. .box_type{
  466. width: 410rpx;
  467. height: 48rpx;
  468. background: #EEEEEE;
  469. border-radius: 8rpx 8rpx 8rpx 8rpx;
  470. opacity: 1;
  471. font-size: 28rpx;
  472. font-weight: 500;
  473. color: #999999;
  474. padding-left: 24rpx;
  475. line-height: 48rpx;
  476. display: -webkit-box;
  477. word-break: break-all;
  478. text-overflow: ellipsis;
  479. overflow: hidden;
  480. -webkit-box-orient: vertical;
  481. -webkit-line-clamp:1;
  482. }
  483. .box_num{
  484. width: 410rpx;
  485. display: flex;
  486. justify-content: space-between;
  487. align-items: center;
  488. }
  489. .bn_left{
  490. width: 106rpx;
  491. height: 38rpx;
  492. font-size: 28rpx;
  493. font-weight: bold;
  494. color: #333333;
  495. line-height: 36rpx;
  496. }
  497. .beizhu{
  498. max-width: 500rpx;
  499. display: -webkit-box;
  500. word-break: break-all;
  501. text-overflow: ellipsis;
  502. overflow: hidden;
  503. -webkit-box-orient: vertical;
  504. -webkit-line-clamp:1;
  505. }
  506. </style>