orderDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <template>
  2. <view class="success" :style="{ background: `url(${bgImg}) #F4F5F9` }">
  3. <view class="success_status">
  4. <view class="status flex aic">
  5. <view class="status_text">{{ orderInfo.paymentStatus | orderStatus }}</view>
  6. </view>
  7. </view>
  8. <view class="success_content">
  9. <view class="success_info">
  10. <view class="">
  11. <view class="success_item flex jcsb aic">
  12. <view class="flex aic">
  13. <view class="label">收件地址</view>
  14. <text class="bold">{{ orderInfo.email }}</text>
  15. </view>
  16. <!-- <view class="success_btn" @click="copyText()">复制</view>-->
  17. </view>
  18. <view class="success_item flex aic">
  19. <view class="label">收件人</view>
  20. <text>{{ orderInfo.recipientName }}({{ orderInfo.contactPhone }})</text>
  21. </view>
  22. <view v-if="orderInfo.completedLink" class="success_item flex aic">
  23. <view class="label">拍摄视频地址</view>
  24. <u-link :href="baiduLink" text="百度云盘链接" @click="click"></u-link>
  25. <view class="copy" @click="copyText(orderInfo.completedLink)">复制</view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="line" :style="{ background: `url(${successImg}) no-repeat` }">
  30. <view class="line-circle"></view>
  31. </view>
  32. <view class="detail">
  33. <view class="detail_item flex aic jcsb">
  34. <text>订单金额</text>
  35. <view class="datas flex">
  36. <text>{{ orderInfo.totalAmount }}元</text>
  37. </view>
  38. </view>
  39. <view class="detail_item flex aic jcsb" @click="goCase">
  40. <text>套餐名称</text>
  41. <view class="datas flex">
  42. <text>{{ orderInfo.packageName }}</text>
  43. <!-- <view class="copy">详情</view> -->
  44. </view>
  45. </view>
  46. <view class="detail_item flex aic jcsb">
  47. <text>套餐内容</text>
  48. <view class="datas flex">
  49. <text>{{ orderInfo.quantity }}条</text>
  50. </view>
  51. </view>
  52. <view class="detail_item flex aic jcsb" v-if="orderInfo.paymentStatus!=='WAIT_PAYMENT'">
  53. <text>支付方式</text>
  54. <view class="datas flex">
  55. <text>微信支付</text>
  56. </view>
  57. </view>
  58. <view class="detail_item flex aic jcsb">
  59. <text>订单编号</text>
  60. <view class="datas flex">
  61. <text>{{ orderInfo.orderNumber }}</text>
  62. <view class="copy" @click="copyText(orderInfo.orderNumber)">复制</view>
  63. </view>
  64. </view>
  65. <view class="detail_item flex aic jcsb">
  66. <text>订单时间</text>
  67. <view class="datas flex">
  68. <text>{{ orderInfo.createDate }}</text>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="btns">
  74. <view v-if="orderInfo.paymentStatus==='WAIT_PAYMENT'" class="order-bottom-right flex">
  75. <view class="btn btn1 p2" @click.stop="handleCancelOrder(orderInfo.orderId)">取消</view>
  76. <view class="btn btn2 p1" @click.stop="submitOrder(orderInfo)">支付</view>
  77. </view>
  78. <view v-else class="order-bottom-right flex">
  79. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='WAIT_SEND'"
  80. @click.stop="handleCancelOrder(orderInfo.orderId)">
  81. 取消
  82. </view>
  83. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='WAIT_ORDER'"
  84. @click.stop="handleCancelOrder(orderInfo.orderId)">
  85. 取消
  86. </view>
  87. <view v-if="orderInfo.paymentStatus==='WAIT_SEND'" class="btn btn1 p2 ml-6 btn-theme">寄样</view>
  88. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='SHOOTING'"
  89. @click.stop="handleAftermarketOrder(orderInfo.orderId)">申请售后
  90. </view>
  91. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='DELIVERED'"
  92. @click.stop="handleAftermarketOrder(orderInfo.orderId)">申请售后
  93. </view>
  94. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='WAIT_CHECK'"
  95. @click.stop="handleAftermarketOrder(orderInfo.orderId)">申请售后
  96. </view>
  97. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='AFTER_SALE'"
  98. @click.stop="handleCancelAftermarketOrder(orderInfo.orderId)">撤回申请
  99. </view>
  100. <view class="btn btn1 p2 ml-6 btn-theme" v-if="orderInfo.paymentStatus==='WAIT_CHECK'"
  101. @click.stop="handleCheckOrder(orderInfo.orderId)">确认验收
  102. </view>
  103. </view>
  104. <view class="back" @click="goHome">返回首页</view>
  105. </view>
  106. </view>
  107. </template>
  108. <script>
  109. import {
  110. copy
  111. } from "@/utils/utils";
  112. import {
  113. aftermarketOrder,
  114. cancelAftermarketOrder,
  115. cancelOrder,
  116. checkOrder,
  117. getOrderDetail,
  118. updateOrder
  119. } from "../../apis/order";
  120. import {
  121. goHome
  122. } from "../../utils/utils";
  123. import {
  124. submitOrder
  125. } from "../../apis";
  126. export default {
  127. components: {},
  128. data() {
  129. return {
  130. orderId: '',
  131. orderInfo: {
  132. completedLink: '',
  133. paymentStatus: '',
  134. packageName: "",
  135. createDate: "",
  136. orderNumber: '',
  137. shootingRequirements: '',
  138. email: '',
  139. },
  140. bgImg: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/bg_top%403x.png",
  141. payImg: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_paysuccess.png",
  142. successImg: 'https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/img_quekou.png'
  143. };
  144. },
  145. onLoad(options) {
  146. if (options.orderId) {
  147. this.orderId = options.orderId;
  148. }
  149. this.getData();
  150. },
  151. computed: {
  152. baiduLink() {
  153. const linkRegex = /链接:\s*(https:\/\/pan.baidu.com\/s\/\S+)/;
  154. const codeRegex = /提取码:\s*(\w+)/;
  155. const linkMatch = this.orderInfo.completedLink.match(linkRegex);
  156. const codeMatch = this.orderInfo.completedLink.match(codeRegex);
  157. let link = "";
  158. let accessCode = "";
  159. if (linkMatch && linkMatch.length > 1) {
  160. link = linkMatch[1];
  161. }
  162. if (codeMatch && codeMatch.length > 1) {
  163. accessCode = codeMatch[1];
  164. }
  165. return link +'?pwd='+ accessCode
  166. }
  167. },
  168. watch: {
  169. // 可以在这里添加监听器,例如监听订单状态变化后更新页面显示
  170. },
  171. methods: {
  172. getData() {
  173. getOrderDetail({
  174. orderId: this.orderId
  175. }).then(res => {
  176. this.orderInfo = res;
  177. });
  178. },
  179. goCase() {
  180. uni.navigateTo({
  181. url: '/pages/index/detail?type=1'
  182. });
  183. },
  184. goHome() {
  185. goHome();
  186. },
  187. // 复制
  188. copyText(text) {
  189. copy(text);
  190. },
  191. // 处理取消订单逻辑
  192. handleCancelOrder(orderId) {
  193. this.showConfirmModal('你确定要取消订单吗?', () => {
  194. cancelOrder({
  195. orderId: Number(orderId)
  196. }).then(() => {
  197. uni.navigateBack();
  198. });
  199. });
  200. },
  201. // 处理更新订单逻辑
  202. handleUpdateOrder(orderId) {
  203. this.showConfirmModal('你确定要取消订单吗?', () => {
  204. updateOrder({
  205. orderId: Number(orderId),
  206. }).then(() => {
  207. uni.navigateBack();
  208. });
  209. });
  210. },
  211. // 处理确认验收逻辑
  212. handleCheckOrder(orderId) {
  213. this.showConfirmModal('你确定要验收该订单吗?', () => {
  214. checkOrder({
  215. orderId: Number(orderId),
  216. }).then(() => {
  217. uni.navigateBack();
  218. });
  219. });
  220. },
  221. // 处理申请售后逻辑
  222. handleAftermarketOrder(orderId) {
  223. this.showConfirmModal('你确定要申请售后吗?', () => {
  224. aftermarketOrder({
  225. orderId: Number(orderId)
  226. }).then(() => {
  227. uni.navigateBack();
  228. });
  229. });
  230. },
  231. // 处理撤销售后逻辑
  232. handleCancelAftermarketOrder(orderId) {
  233. this.showConfirmModal('你确定要撤销售后吗?', () => {
  234. cancelAftermarketOrder({
  235. orderId: Number(orderId)
  236. }).then(() => {
  237. uni.navigateBack();
  238. });
  239. });
  240. },
  241. // 显示确认模态框的通用函数
  242. showConfirmModal(content, confirmCallback) {
  243. uni.showModal({
  244. title: '提示',
  245. content: content,
  246. success: function(res) {
  247. if (res.confirm) {
  248. confirmCallback();
  249. } else if (res.cancel) {
  250. console.log('用户点击取消');
  251. }
  252. }
  253. });
  254. },
  255. submitOrder(params) {
  256. submitOrder({
  257. ...params
  258. }).then((res) => {
  259. // 检查是否在微信浏览器中
  260. if (typeof WeixinJSBridge === 'undefined') {
  261. if (document.addEventListener) {
  262. document.addEventListener('WeixinJSBridgeReady', () => {
  263. this.invokePayment(res);
  264. }, false);
  265. } else if (document.attachEvent) {
  266. document.attachEvent('WeixinJSBridgeReady', () => {
  267. this.invokePayment(res);
  268. });
  269. document.attachEvent('onWeixinJSBridgeReady', () => {
  270. this.invokePayment(res);
  271. });
  272. }
  273. } else {
  274. this.invokePayment(res);
  275. }
  276. });
  277. },
  278. invokePayment(rePayInfo) {
  279. WeixinJSBridge.invoke(
  280. 'getBrandWCPayRequest', {
  281. appId: rePayInfo.appid,
  282. timeStamp: rePayInfo.timeStamp,
  283. nonceStr: rePayInfo.nonceStr,
  284. package: rePayInfo.packages,
  285. signType: rePayInfo.signType,
  286. paySign: rePayInfo.sign
  287. },
  288. (res) => {
  289. if (res.err_msg === 'get_brand_wcpay_request:ok') {
  290. this.getData();
  291. } else if (res.err_msg === 'get_brand_wcpay_request:cancel') {
  292. uni.showToast({
  293. title: '用户取消了支付',
  294. icon: 'none'
  295. });
  296. } else {
  297. console.error('支付失败', res.err_msg);
  298. // 处理支付失败的逻辑
  299. }
  300. }
  301. );
  302. },
  303. },
  304. created() {
  305. // 可以在这里添加组件创建时的初始化逻辑
  306. },
  307. mounted() {
  308. // 可以在这里添加组件挂载后的逻辑,例如绑定一些事件监听器等
  309. },
  310. };
  311. </script>
  312. <style lang='scss' scoped>
  313. .success {
  314. width: 100%;
  315. position: absolute;
  316. top: 0;
  317. bottom: 0;
  318. display: flex;
  319. flex-direction: column;
  320. background-size: contain !important;
  321. background-repeat: no-repeat !important;
  322. background-position: top;
  323. padding: 0 24rpx;
  324. .success_status {
  325. margin-top: 64rpx;
  326. display: flex;
  327. flex-direction: column;
  328. align-items: center;
  329. .pay_img {
  330. width: 48rpx;
  331. height: 48rpx;
  332. margin-left: 16rpx;
  333. }
  334. .status_text {
  335. font-weight: 500;
  336. font-size: 40rpx;
  337. color: #0D121A;
  338. }
  339. .status_tip {
  340. font-weight: 400;
  341. font-size: 28rpx;
  342. color: #9EA3B1;
  343. margin-top: 20rpx;
  344. }
  345. }
  346. .success_content {
  347. border-radius: 32rpx;
  348. overflow: hidden;
  349. margin-top: 64rpx;
  350. .success_info {
  351. background-color: #fff;
  352. padding: 36rpx 32rpx 8rpx;
  353. .success_item {
  354. margin-bottom: 20rpx;
  355. .label {
  356. min-width: 120rpx;
  357. font-weight: 400;
  358. font-size: 28rpx;
  359. color: #9EA3B1;
  360. margin-right: 16rpx;
  361. }
  362. text {
  363. font-size: 32rpx;
  364. color: #0D121A;
  365. }
  366. }
  367. }
  368. .success_btn {
  369. width: 80rpx;
  370. height: 40rpx;
  371. font-weight: 500;
  372. background: #F4F5F9;
  373. border-radius: 48rpx;
  374. font-size: 24rpx;
  375. color: #0D121A;
  376. text-align: center;
  377. line-height: 40rpx;
  378. }
  379. .line {
  380. width: 100%;
  381. height: 40rpx;
  382. background-size: cover !important;
  383. padding: 0 32rpx;
  384. display: flex;
  385. justify-content: center;
  386. align-items: center;
  387. .line-circle {
  388. width: 100%;
  389. border: 2rpx dashed #EDEDED;
  390. height: 2rpx;
  391. }
  392. }
  393. .detail {
  394. background-color: #fff;
  395. padding: 32rpx 32rpx 40rpx;
  396. .detail_item {
  397. margin-bottom: 36rpx;
  398. text {
  399. white-space: nowrap;
  400. font-weight: 400;
  401. font-size: 28rpx;
  402. color: #0D121A;
  403. }
  404. .datas {
  405. .copy {
  406. width: 80rpx;
  407. height: 40rpx;
  408. background: #F4F5F9;
  409. border-radius: 48rpx;
  410. font-weight: 500;
  411. font-size: 24rpx;
  412. color: #061714;
  413. text-align: center;
  414. line-height: 40rpx;
  415. margin-left: 16rpx;
  416. }
  417. }
  418. }
  419. .detail_item:nth-last-child(1) {
  420. margin-bottom: 0;
  421. }
  422. }
  423. .success_title {
  424. color: #9DA3A2;
  425. }
  426. }
  427. .btns {
  428. padding: 96rpx 32rpx;
  429. view {
  430. width: 100%;
  431. height: 84rpx;
  432. // border-radius: 48rpx;
  433. display: flex;
  434. justify-content: center;
  435. align-items: center;
  436. font-size: 32rpx;
  437. }
  438. .bind {
  439. color: #061714;
  440. margin-bottom: 32rpx;
  441. font-weight: 500rpx;
  442. background: linear-gradient(140deg, #246AF1 0%, #2F98EF 100%);
  443. }
  444. .back {
  445. font-weight: bold;
  446. background: #FFFFFF;
  447. // border: 4rpx solid #E7EAEA;
  448. color: #061714;
  449. }
  450. }
  451. .ml16 {
  452. margin-left: 16rpx;
  453. }
  454. }
  455. .order-bottom-right {
  456. margin-bottom: 36rpx;
  457. }
  458. .copy {
  459. width: 80rpx;
  460. height: 40rpx;
  461. background: #F4F5F9;
  462. border-radius: 48rpx;
  463. font-weight: 500;
  464. font-size: 24rpx;
  465. color: #061714;
  466. text-align: center;
  467. line-height: 40rpx;
  468. margin-left: 16rpx;
  469. }
  470. </style>