orderDetail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. <template>
  2. <view class="order-detail-page">
  3. <!-- 顶部导航栏 -->
  4. <view class="custom-navbar">
  5. <view class="navbar-left">
  6. <text class="fa fa-angle-left" @click="goBack"></text>
  7. </view>
  8. <view class="navbar-right scale-tap" @click="goPages('/pages/crowdFunding/customerService')">
  9. <image src="@/static/crowdFunding/customer-service-btn.png" style="width: 60rpx; height: 60rpx"
  10. mode="widthFix">
  11. </image>
  12. </view>
  13. </view>
  14. <!-- status:0待支付,1已支付,2已发货/待收货,3已收货,5已完成,6退款中,8关闭(取消或退款后),9已完成 -->
  15. <!-- 状态栏 -->
  16. <view class="status-bar">
  17. <!-- <image v-if="statusIcon" :src="statusIcon" class="status-icon"/> -->
  18. <!-- 失败 -->
  19. <image v-if="status == 8" :src="'../../static/crowdFunding/fail.png'" class="status-icon" />
  20. <!-- 成功 -->
  21. <image v-else-if="status == 5 || status == 3 || status == 9" :src="'../../static/crowdFunding/success.png'"
  22. class="status-icon" />
  23. <!-- 进行中 -->
  24. <image v-else-if="status == 2 || status == 6" :src="'../../static/crowdFunding/loading.png'"
  25. class="status-icon" />
  26. <text class="status-title">{{ statusTitle }}</text>
  27. </view>
  28. <!-- 收货信息 -->
  29. <view class="address-card scale-tap" @click="goPages('/pages/crowdFunding/receivingAddress')">
  30. <view class="row">
  31. <text class="name">{{ address.realname }}</text>
  32. <text class="mobile">{{ address.mobile }}</text>
  33. <text class="default" v-if="address.is_default == 'yse'">默认</text>
  34. </view>
  35. <view class="address">收获地址:{{ address.area + address.address }}</view>
  36. </view>
  37. <!-- 商品卡片 -->
  38. <view class="product-card">
  39. <view class="product-top" @click="goPages('/pages/crowdFunding/crowdfundingDetails?id=' + product.id)">
  40. <image class="product-img" :src="product.img" />
  41. <view class="product-info">
  42. <view class="product-title"><text class="two-omit">{{ product.title }} </text>
  43. <image class="arrow" mode="widthFix" src="@/static/crowdFunding/right.png" />
  44. </view>
  45. <view class="product-desc">
  46. {{ product.desc }}
  47. </view>
  48. </view>
  49. </view>
  50. <view class="product-bom">
  51. <view class="product-spec">回报档:¥{{ product.price }} {{ product.spec }}
  52. <text class="count">x{{ product.count }}</text>
  53. </view>
  54. <view class="product-time">
  55. 预计发货时间:{{ product.deliveryTime }}
  56. </view>
  57. <!-- <view class="product-tip">{{ product.tip }}</view> -->
  58. </view>
  59. <!-- 费用明细 -->
  60. <!-- <view class="fee-row">
  61. <text>运费</text>
  62. <text>包邮</text>
  63. </view> -->
  64. <view class="fee-row total">
  65. <text>总金额</text>
  66. <text class="total-price">¥{{ product.total }}</text>
  67. </view>
  68. </view>
  69. <!-- 订单信息 -->
  70. <view class="order-info-card">
  71. <view class="info-row" v-if="order.orderNo">
  72. <text>订单编号</text>
  73. <view><text>{{ order.orderNo }}</text>
  74. <text class="copy-btn" @click="copy(order.orderNo)">复制</text>
  75. </view>
  76. </view>
  77. <view class="info-row" v-if="order.createTime">
  78. <text>下单时间</text>
  79. <text>{{ order.createTime }}</text>
  80. </view>
  81. <view class="info-row" v-if="order.payTime">
  82. <text>付款时间</text>
  83. <text>{{ order.payTime }}</text>
  84. </view>
  85. </view>
  86. <!-- 底部操作栏 -->
  87. <view class="order-bottom">
  88. <template v-if="status == 0">
  89. <view class="btn scale-tap btn-cancel" @click="cancelOrder">取消订单</view>
  90. <view class="btn scale-tap btn-pay" @click="payOrder">立即支付</view>
  91. </template>
  92. <template v-else-if="status == 1">
  93. <view class="btn scale-tap btn-refund" @click="refundOrder">申请退款</view>
  94. </template>
  95. <template v-else-if="status == 2">
  96. <view class="btn scale-tap btn-pay" @click="confirmOrder">确认收货</view>
  97. <!-- <view class="btn scale-tap btn-comment" @click="commentOrder">去评价</view> -->
  98. </template>
  99. <template v-else-if="status == 3 || status == 5 || status == 9">
  100. <view class="btn scale-tap btn-delete" @click="deleteOrder">删除订单</view>
  101. <!-- <view class="btn scale-tap btn-comment" @click="commentOrder">去评价</view> -->
  102. </template>
  103. <template v-else-if="status == 6">
  104. <view class="btn btn-delete " style="background: #eee;">退款中</view>
  105. <!-- <view class="btn scale-tap btn-comment" @click="commentOrder">去评价</view> -->
  106. </template>
  107. <template v-else-if="status == 8">
  108. <!-- <view class="btn btn-delete" style="background: #eee;">已关闭</view> -->
  109. <view class="btn scale-tap btn-delete" @click="deleteOrder">删除订单</view>
  110. <!-- <view class="btn scale-tap btn-comment" @click="commentOrder">去评价</view> -->
  111. </template>
  112. <template v-else>
  113. <!-- <view class="btn scale-tap btn-delete" @click="deleteOrder">删除订单</view> -->
  114. </template>
  115. </view>
  116. <!-- 支付方式选择弹窗 -->
  117. <uni-popup ref="paymentPopup" type="bottom">
  118. <view class="payment-popup">
  119. <view class="popup-header">
  120. <view class="popup-title">选择支付方式</view>
  121. </view>
  122. <view class="payment-options">
  123. <view class="payment-option" @tap="selectPayment('alipay')">
  124. <image class="payment-icon" src="../../static/icon/pay_ali.png" mode="aspectFit"></image>
  125. <view class="payment-name">支付宝支付</view>
  126. <image class="payment-select"
  127. :src="paymentMethod === 'alipay' ? '../../static/icon/wd_icon_gouxuan05.png' : '../../static/icon/wd_icon_gouxuan04.png'"
  128. mode="aspectFit"></image>
  129. </view>
  130. <view v-if="isWeChatPay" class="payment-option" @tap="selectPayment('wechat')">
  131. <image class="payment-icon" src="../../static/icon/pay_wx.png" mode="aspectFit"></image>
  132. <view class="payment-name">微信支付</view>
  133. <image class="payment-select"
  134. :src="paymentMethod === 'wechat' ? '../../static/icon/wd_icon_gouxuan05.png' : '../../static/icon/wd_icon_gouxuan04.png'"
  135. mode="aspectFit"></image>
  136. </view>
  137. </view>
  138. <view class="confirm-payment" @tap="confirmPayment">立即支付</view>
  139. </view>
  140. </uni-popup>
  141. <!-- 提示框 -->
  142. <DialogBox ref="DialogBox"></DialogBox>
  143. </view>
  144. </template>
  145. <script>
  146. export default {
  147. data() {
  148. return {
  149. statusType: "waitPay", // waitPay, waitSend, finish, waitComment, fail
  150. status: "",
  151. statusTitle: "", // 根据statusType动态切换
  152. statusIcon: "loading", // 可根据状态切换icon loading fail success
  153. address: {},
  154. product: {},
  155. order: {},
  156. paymentMethod: 'alipay', // 默认支付宝支付
  157. isWeChatPay: true, // 是否显示微信支付选项
  158. orderId: "",
  159. };
  160. },
  161. onLoad(options) {
  162. this.getOrderDetail(options.orderId);
  163. this.orderId = options.orderId;
  164. },
  165. methods: {
  166. goBack() {
  167. uni.navigateBack();
  168. },
  169. goPages(url) {
  170. uni.navigateTo({
  171. url
  172. });
  173. },
  174. copy(val) {
  175. uni.setClipboardData({
  176. data: val
  177. });
  178. },
  179. cancelOrder() {
  180. this.$refs["DialogBox"].confirm({
  181. title: "提示",
  182. content: "确定要取消订单吗?",
  183. DialogType: "inquiry",
  184. btn1: "否",
  185. btn2: "是",
  186. animation: 0,
  187. }).then((res) => {
  188. if (res) {
  189. this.orderAction('cancel');
  190. }
  191. });
  192. },
  193. payOrder() {
  194. this.$refs.paymentPopup.open();
  195. },
  196. selectPayment(method) {
  197. this.paymentMethod = method;
  198. },
  199. confirmPayment() {
  200. this.orderAction('pay', this.paymentMethod);
  201. this.$refs.paymentPopup.close();
  202. },
  203. refundOrder() {
  204. this.$refs.DialogBox.confirm({
  205. title: "提示",
  206. content: "确定要申请退款吗?",
  207. DialogType: "inquiry",
  208. btn1: "否",
  209. btn2: "是",
  210. animation: 0,
  211. }).then((res) => {
  212. if (res) {
  213. this.orderAction('refund');
  214. }
  215. });
  216. },
  217. deleteOrder() {
  218. this.$refs.DialogBox.confirm({
  219. title: "提示",
  220. content: "确定要删除订单吗?",
  221. DialogType: "inquiry",
  222. btn1: "否",
  223. btn2: "是",
  224. animation: 0,
  225. }).then((res) => {
  226. if (res) {
  227. this.orderAction('del');
  228. }
  229. });
  230. },
  231. confirmOrder() {
  232. this.$refs.DialogBox.confirm({
  233. title: "提示",
  234. content: "是否要确认收货吗?",
  235. DialogType: "inquiry",
  236. btn1: "否",
  237. btn2: "是",
  238. animation: 0,
  239. }).then((res) => {
  240. if (res) {
  241. this.orderAction('finish');
  242. }
  243. });
  244. },
  245. commentOrder() { },
  246. orderAction(act, payType = '') {
  247. var order_id = this.orderId;
  248. var _this = this;
  249. console.log({
  250. order_id,
  251. act: act,
  252. payType: payType,
  253. }, '支付接口参数');
  254. uni.request({
  255. url: this.$apiHost + '/Order/action',
  256. method: 'GET',
  257. data: {
  258. order_id: order_id,
  259. act: act,
  260. payType: payType,
  261. uuid: getApp().globalData.uuid,
  262. skey: getApp().globalData.skey
  263. },
  264. success: (res) => {
  265. console.log(res.data, "订单操作结果");
  266. if (res.data && res.data.success == 'yes') {
  267. // 微信支付
  268. console.log(payType, "支付方式");
  269. if (payType === 'wx') {
  270. console.log(res.data.wepay, "微信支付");
  271. uni.requestPayment({
  272. provider: "wxpay",
  273. orderInfo: {
  274. appid: res.data.wepay.appid,
  275. partnerid: res.data.wepay.partnerid,
  276. prepayid: res.data.wepay.prepayid,
  277. package: "Sign=WXPay",
  278. noncestr: res.data.wepay.noncestr,
  279. timestamp: res.data.wepay.timestamp,
  280. sign: res.data.wepay.sign
  281. },
  282. success: (payRes) => {
  283. that.checkPayStatus();
  284. },
  285. fail: (err) => {
  286. uni.hideLoading();
  287. that.isSubmitting = false;
  288. uni.showToast({ title: '支付取消', icon: 'none' });
  289. }
  290. });
  291. return;
  292. }
  293. // 支付宝支付
  294. else if (payType === 'alipay') {
  295. console.log(res.data.ali_pay, "支付宝支付");
  296. uni.requestPayment({
  297. provider: "alipay",
  298. orderInfo: res.data.ali_pay,
  299. success: (payRes) => {
  300. that.checkPayStatus();
  301. },
  302. fail: (err) => {
  303. uni.hideLoading();
  304. that.isSubmitting = false;
  305. uni.showToast({ title: '支付取消', icon: 'none' });
  306. }
  307. });
  308. return;
  309. }
  310. uni.showToast({
  311. title: res.data.str,
  312. icon: 'none'
  313. });
  314. this.getOrderDetail(this.order.orderNo);
  315. if (act == 'cancel') {
  316. this.goBack();
  317. }
  318. } else {
  319. uni.showToast({
  320. title: res.data.message || '操作失败',
  321. icon: 'none'
  322. });
  323. }
  324. },
  325. fail: () => {
  326. uni.showToast({
  327. title: '操作失败',
  328. icon: 'none'
  329. });
  330. }
  331. });
  332. },
  333. getOrderDetail(orderId) {
  334. uni.request({
  335. url: this.$apiHost + '/Order/detail?order_id=' + orderId,
  336. method: 'GET',
  337. data: {
  338. uuid: getApp().globalData.uuid,
  339. skey: getApp().globalData.skey
  340. },
  341. success: (res) => {
  342. console.log(res.data.data, "获取订单详情");
  343. if (res.data && res.data.success == 'yes') {
  344. let data = res.data.data;
  345. if (data.address) {
  346. this.address = JSON.parse(data.address);
  347. }
  348. this.order = {
  349. orderNo: data.linkid,
  350. createTime: data.create_time,
  351. payTime: data.order_time,
  352. }
  353. if (data.crowdfund) {
  354. this.product = {
  355. price: data.crowdfund.price,
  356. img: data.crowdfund.image,
  357. title: data.crowdfund.title,
  358. desc: "",
  359. spec: data.crowdfund.title2,
  360. count: 1,
  361. total: data.money,
  362. deliveryTime: data.crowdfund.delivery,
  363. id: data.crowdfund.id,
  364. // tip: "温馨提示:该链接仅购买线下实物卡片!不含线上卡牌壁纸",
  365. }
  366. }
  367. this.status = data.status;
  368. this.statusTitle = data.status_name;
  369. }
  370. },
  371. fail: () => {
  372. uni.showToast({
  373. title: '获取订单详情失败',
  374. icon: 'none'
  375. });
  376. },
  377. complete: () => {
  378. uni.hideLoading();
  379. }
  380. });
  381. },
  382. },
  383. mounted() {
  384. // 可根据实际订单状态设置statusType/statusTitle/statusIcon
  385. // 例如:this.statusType = 'waitPay'; this.statusTitle = '待支付';
  386. },
  387. };
  388. </script>
  389. <style lang="scss">
  390. .order-detail-page {
  391. min-height: 100vh;
  392. background: #f2f6f2;
  393. .custom-navbar {
  394. display: flex;
  395. flex-direction: row;
  396. align-items: center;
  397. justify-content: space-between;
  398. height: 90rpx;
  399. padding: 0 40rpx;
  400. padding-right: 30rpx;
  401. padding-top: var(--status-bar-height);
  402. background-color: transparent;
  403. position: sticky;
  404. top: 0;
  405. height: calc(90rpx + var(--status-bar-height));
  406. z-index: 100;
  407. .navbar-left {
  408. height: 80rpx;
  409. display: flex;
  410. align-items: center;
  411. justify-content: center;
  412. .fa-angle-left {
  413. font-size: 48rpx;
  414. color: #333;
  415. }
  416. }
  417. .navbar-right {
  418. width: 60rpx;
  419. height: 60rpx;
  420. display: flex;
  421. justify-content: center;
  422. align-items: center;
  423. }
  424. }
  425. .status-bar {
  426. display: flex;
  427. align-items: center;
  428. padding: 32rpx 32rpx 0 32rpx;
  429. .status-icon {
  430. width: 40rpx;
  431. height: 40rpx;
  432. margin-right: 12rpx;
  433. }
  434. .status-title {
  435. font-size: 36rpx;
  436. font-weight: bold;
  437. color: #1F1F1F;
  438. }
  439. }
  440. .address-card {
  441. background: #fff;
  442. border-radius: 16rpx;
  443. margin: 24rpx 16rpx 0 16rpx;
  444. padding: 24rpx;
  445. background: url("../../static/crowdFunding/order-detail-card-bg.png") no-repeat top right / auto 100%,
  446. #fff;
  447. .row {
  448. display: flex;
  449. align-items: center;
  450. margin-bottom: 8rpx;
  451. .name {
  452. font-size: 30rpx;
  453. font-weight: bold;
  454. margin-right: 18rpx;
  455. }
  456. .mobile {
  457. font-size: 30rpx;
  458. margin-right: 18rpx;
  459. }
  460. .default {
  461. font-size: 22rpx;
  462. color: #acf934;
  463. background: #1f1f1f;
  464. border-radius: 8rpx;
  465. padding: 2rpx 12rpx;
  466. margin-right: 12rpx;
  467. }
  468. }
  469. .address {
  470. font-size: 26rpx;
  471. color: #666;
  472. }
  473. }
  474. .product-card {
  475. background: #fff;
  476. border-radius: 16rpx;
  477. margin: 24rpx 16rpx 0 16rpx;
  478. padding: 24rpx;
  479. .product-top {
  480. display: flex;
  481. align-items: center;
  482. justify-content: space-between;
  483. .product-img {
  484. width: 120rpx;
  485. height: 120rpx;
  486. border-radius: 12rpx;
  487. margin-right: 18rpx;
  488. }
  489. .product-info {
  490. flex: 1;
  491. display: flex;
  492. align-items: center;
  493. justify-content: space-between;
  494. .product-title {
  495. width: 100%;
  496. display: flex;
  497. align-items: center;
  498. justify-content: space-between;
  499. font-size: 28rpx;
  500. font-weight: bold;
  501. color: #1f1f1f;
  502. display: flex;
  503. align-items: center;
  504. .two-omit {
  505. width: 400rpx;
  506. }
  507. .arrow {
  508. width: 60rpx;
  509. height: 60rpx;
  510. // margin-left: 140rpx;
  511. }
  512. }
  513. .product-desc {
  514. font-size: 24rpx;
  515. color: #1F1F1F;
  516. margin: 8rpx 0;
  517. }
  518. }
  519. }
  520. .product-bom {
  521. padding-top: 15rpx;
  522. .product-spec {
  523. font-size: 26rpx;
  524. color: #1F1F1F;
  525. margin: 8rpx 0;
  526. display: flex;
  527. align-items: center;
  528. justify-content: space-between;
  529. .count {
  530. color: #888;
  531. font-size: 22rpx;
  532. margin-top: 16rpx;
  533. margin-top: 8rpx;
  534. }
  535. }
  536. .product-time {
  537. font-size: 24rpx;
  538. color: #b2b2b2;
  539. margin-bottom: 8rpx;
  540. }
  541. .product-tip {
  542. font-size: 26rpx;
  543. color: #b2b2b2;
  544. background: #f6faf6;
  545. border-radius: 8rpx;
  546. padding: 8rpx 12rpx;
  547. }
  548. }
  549. .arrow {
  550. width: 32rpx;
  551. height: 32rpx;
  552. margin-left: 8rpx;
  553. }
  554. }
  555. .fee-row {
  556. display: flex;
  557. justify-content: space-between;
  558. align-items: center;
  559. padding: 0;
  560. height: 64rpx;
  561. font-size: 28rpx;
  562. color: #1F1F1F;
  563. text:first-child {
  564. color: #999;
  565. }
  566. &.total {
  567. font-weight: bold;
  568. color: #1f1f1f;
  569. justify-content: flex-end;
  570. text:first-child {
  571. color: #1f1f1f;
  572. }
  573. .total-price {
  574. color: #ff5500;
  575. font-size: 32rpx;
  576. }
  577. }
  578. }
  579. .order-info-card {
  580. background: #fff;
  581. border-radius: 16rpx;
  582. margin: 24rpx 16rpx 0 16rpx;
  583. padding: 24rpx;
  584. .info-row {
  585. display: flex;
  586. align-items: center;
  587. justify-content: space-between;
  588. height: 56rpx;
  589. font-size: 26rpx;
  590. >text:first-child {
  591. color: #999;
  592. }
  593. .copy-btn {
  594. color: #1f1f1f;
  595. background: #f6faf6;
  596. border-radius: 8rpx;
  597. font-size: 24rpx;
  598. margin-left: 18rpx;
  599. padding: 2rpx 16rpx;
  600. }
  601. }
  602. }
  603. .order-bottom {
  604. position: fixed;
  605. left: 0;
  606. right: 0;
  607. bottom: 0;
  608. background: #fff;
  609. display: flex;
  610. align-items: center;
  611. justify-content: flex-end;
  612. padding: 0 32rpx;
  613. height: 110rpx;
  614. box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.04);
  615. z-index: 10;
  616. .btn {
  617. min-width: 180rpx;
  618. height: 72rpx;
  619. line-height: 72rpx;
  620. border-radius: 44rpx;
  621. text-align: center;
  622. font-size: 30rpx;
  623. padding: 0 32rpx;
  624. margin-left: 24rpx;
  625. &.btn-pay {
  626. background: #1f1f1f;
  627. color: #acf934;
  628. }
  629. &.btn-cancel {
  630. background: #fff;
  631. color: #1f1f1f;
  632. border: 2rpx solid #e5e5e5;
  633. }
  634. &.btn-refund {
  635. background: #1f1f1f;
  636. color: #acf934;
  637. }
  638. &.btn-delete {
  639. background: #fff;
  640. color: #1f1f1f;
  641. border: 2rpx solid #e5e5e5;
  642. }
  643. &.btn-comment {
  644. background: #1f1f1f;
  645. color: #acf934;
  646. }
  647. }
  648. }
  649. .payment-popup {
  650. background: #fff;
  651. border-radius: 24rpx 24rpx 0 0;
  652. padding: 32rpx;
  653. .popup-header {
  654. display: flex;
  655. align-items: center;
  656. justify-content: space-between;
  657. margin-bottom: 32rpx;
  658. .popup-title {
  659. font-size: 32rpx;
  660. font-weight: bold;
  661. color: #1f1f1f;
  662. }
  663. }
  664. .payment-options {
  665. .payment-option {
  666. display: flex;
  667. align-items: center;
  668. padding: 24rpx 0;
  669. border-bottom: 2rpx solid #f6faf6;
  670. .payment-icon {
  671. width: 48rpx;
  672. height: 48rpx;
  673. margin-right: 18rpx;
  674. }
  675. .payment-name {
  676. flex: 1;
  677. font-size: 30rpx;
  678. color: #1f1f1f;
  679. }
  680. .payment-select {
  681. width: 32rpx;
  682. height: 32rpx;
  683. }
  684. }
  685. }
  686. .confirm-payment {
  687. margin-top: 32rpx;
  688. background: #1f1f1f;
  689. color: #acf934;
  690. border-radius: 44rpx;
  691. font-size: 32rpx;
  692. font-weight: bold;
  693. height: 88rpx;
  694. line-height: 88rpx;
  695. text-align: center;
  696. }
  697. }
  698. .btn-delete {
  699. background: #f6faf6;
  700. color: #888;
  701. border: 1px solid #e5e5e5;
  702. }
  703. }
  704. </style>