orderDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <view class="common-page">
  3. <view class="header-box" :style="{
  4. background: `url(${bgImg}) no-repeat 100% 100%`,
  5. paddingBottom: '30rpx'
  6. }" id="headerBox" ref="headerBox">
  7. <view class="navbar-box display-flex-content-center" :style="{
  8. height: `${topData.height}px`,
  9. paddingTop: `${topData.top}px`,
  10. paddingBottom: '40rpx',
  11. color: '#fff',
  12. fontSize: '34rpx',
  13. fontWeight: 'bold'
  14. }">
  15. <view style="position: absolute;left:30rpx" @click="toBack">
  16. <u-icon size="20" name="arrow-left" color="#000"></u-icon>
  17. </view>
  18. <text class="color-black">订单详情</text>
  19. </view>
  20. <view class="success-con display-flex-between fs16">
  21. <view>
  22. <view class="color-black fs16 fw700 mb5">{{statusDisplay.title}}</view>
  23. <view class="color-orange fs14">{{statusDisplay.tips}}</view>
  24. </view>
  25. <image v-if="statusDisplay.icon" style="width: 92rpx; height: 118rpx; flex-shrink: 0;"
  26. :src="`https://work.hkmop.com/static/imgs/${statusDisplay.icon}`" mode="aspectFill">
  27. </image>
  28. </view>
  29. </view>
  30. <view class="content-box mt10">
  31. <!-- 地址信息 -->
  32. <view class="common-card display-flex-center" v-if="truckData">
  33. <image style="width: 64rpx; height: 64rpx; margin-right: 10rpx;flex-shrink: 0;"
  34. src="/static//location-icon.png" mode="aspectFill">
  35. </image>
  36. <view>
  37. <view class="color-23">
  38. <text class="fs15 fw600 mr10">{{truckData.address_name}}</text>
  39. <text class="fs13">{{truckData.address_phone}}</text>
  40. </view>
  41. <view class="fs12 color-5f">
  42. {{`${truckData.address_province}${truckData.address_city}${truckData.address_area}${truckData.address_content}`}}
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 已选商品 -->
  47. <view class="common-card-box">
  48. <view class="goods-list display-flex-center" v-for="(item, index) in goodsList" :key="index">
  49. <image
  50. style="width: 155rpx; height: 155rpx; border-radius: 10rpx;margin-right: 10rpx;flex-shrink: 0;"
  51. :src="item.goods_cover" mode="aspectFill">
  52. </image>
  53. <view>
  54. <view class="display-flex-between goods-name">
  55. <text>{{item.goods_name}}</text>
  56. <text>¥{{item.price_selling}}</text>
  57. </view>
  58. <view class="display-flex-between goods-number">
  59. <text class="gray-tag">{{item.goods_spec}}</text>
  60. <text>×{{item.stock_sales}}</text>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="goods-total display-flex-center">
  65. <text class="fs13 color-4a mr10">共{{data.number_goods}}件商品</text>
  66. <!-- <view class="fs14 color-23 fw500">
  67. 实付:<text class="fs16 fw600 color-red">¥{{realPay}}</text>
  68. </view> -->
  69. </view>
  70. </view>
  71. <!-- 运费信息 -->
  72. <view class="common-card ">
  73. <view class="display-flex-between mb15">
  74. <text class="color-71 flex-shrink">商品总价:</text>
  75. <text class="fw600 text-overflow-single color-red">¥{{ data.amount_total}}</text>
  76. </view>
  77. <view class="display-flex-between mb15">
  78. <text class="color-71 flex-shrink">运费:</text>
  79. <text class="fw600 text-overflow-single">¥{{ data.amount_express}}</text>
  80. </view>
  81. <view class="display-flex-between mb15">
  82. <text class="color-71 flex-shrink">优惠券:</text>
  83. <text class="fw600 text-overflow-single">¥{{ data.coupon_price}}</text>
  84. </view>
  85. <view class="display-flex-between mb15">
  86. <text class="color-71 flex-shrink">使用积分:</text>
  87. <text class="fw600 text-overflow-single">{{data.integral_price}}</text>
  88. </view>
  89. <view class="display-flex-between mb15">
  90. <text class="color-71 flex-shrink">{{[1, 2].includes(data.status) ? '需付款' : '实付'}}:</text>
  91. <text class="fw600 text-overflow-single color-red">¥{{data.amount_real}}</text>
  92. </view>
  93. <view class="display-flex-between" v-if="!([1, 2].includes(data.status))">
  94. <text class="color-71 flex-shrink">支付方式:</text>
  95. <text class="fw600 text-overflow-single">微信</text>
  96. </view>
  97. </view>
  98. <!-- 售后信息 -->
  99. <view class="common-card" v-if="isRefund">
  100. <view class="display-flex-between mb15">
  101. <text class="color-71 flex-shrink">退款原因:</text>
  102. <text class="fw600 text-overflow-single">{{refundData.refund_reason}}</text>
  103. </view>
  104. <view class="display-flex-between mb15">
  105. <text class="color-71 flex-shrink">退款金额:</text>
  106. <text class="fw600 text-overflow-single color-red">¥{{refundData.refund_price}}</text>
  107. </view>
  108. <view class="display-flex-between">
  109. <text class="color-71 flex-shrink">申请说明:</text>
  110. <text class="fw600 text-overflow-single">{{refundData.refund_explain}}</text>
  111. </view>
  112. </view>
  113. <view class="common-card" v-if="isRefund">
  114. <view class="display-flex-between mb15">
  115. <text class="color-71 flex-shrink">上传凭证</text>
  116. </view>
  117. <u-album :urls="refundData.refund_img"></u-album>
  118. </view>
  119. <view class="common-card color-71" v-if="isRefund">
  120. <view class="mb15">
  121. 提交时间:{{data.created_at}}
  122. </view>
  123. <view>处理时间:{{data.refunded_at || '--'}}</view>
  124. </view>
  125. <template v-if="!isRefund">
  126. <!-- 留言 -->
  127. <view class="common-card">
  128. <view class="color-71 mb10">留言</view>
  129. <view class="fs13">{{data.order_remark}}</view>
  130. </view>
  131. <!-- 下单信息 -->
  132. <view class="common-card color-71">
  133. <view class="mb15">
  134. 订单编号:{{data.order_no}}
  135. </view>
  136. <view>下单时间:{{data.created_at}}</view>
  137. </view>
  138. </template>
  139. </view>
  140. <view class="bottom-box display-flex-end"
  141. v-if="[1,2,3,4].includes(data.status) || (isRefund && [1,2].includes(data.refund_status)) || [6, 9].includes(data.status) && !isRefund">
  142. <text class="btn-gray-border" @click="cancelOrder"
  143. v-if="[1, 2, 3].includes(data.status) && !isRefund">取消订单</text>
  144. <text class="common-btn ml10" @click="toPay" v-if="[1, 2].includes(data.status)">立即付款</text>
  145. <text class="common-btn ml10" @click="confirm" v-if="[4].includes(data.status)">确认收货</text>
  146. <text class="common-btn ml10" v-if="[6, 9].includes(data.status) && !isRefund"
  147. @click.stop="toAfterSales">申请售后</text>
  148. <template v-if="isRefund">
  149. <text class="common-btn ml10" @click="cancelAfter" v-if="[1,2].includes(data.refund_status)">取消申请</text>
  150. <!-- <text class="common-btn ml10" @click="editAfter" v-if="[1,2].includes(data.refund_status)">修改申请</text> -->
  151. <!-- <text class="common-btn ml10" @click="toDetail"
  152. v-if="[4].includes(data.refund_status)">查看详情</text> -->
  153. </template>
  154. <!-- <text class="common-btn ml10" v-if="[5].includes(data.status)">查看详情</text> -->
  155. </view>
  156. <!-- 取消订单原因 -->
  157. <AfterReson v-model="showReson" @confirm="cancelConfirm"></AfterReson>
  158. <!-- 确认框 -->
  159. <u-modal :show="confirmShow" :showCancelButton="true" @cancel="confirmShow = false"
  160. :content='confirmData.content' @confirm="confirmHandler"></u-modal>
  161. </view>
  162. </template>
  163. <script>
  164. import AfterReson from '@/components/AfterReson.vue'
  165. export default {
  166. components: { AfterReson },
  167. data() {
  168. return {
  169. data: { status: 1 },
  170. mAddress: {},
  171. bgImg:'',
  172. usePoints: [],
  173. value1: '',
  174. goodsList: [],
  175. truckData: {},
  176. topData: {
  177. top: 0,
  178. height: 0
  179. },
  180. orderNo: '',
  181. pageOptions: {},
  182. showReson: false,
  183. refundData: { refund_img: [] },
  184. confirmShow: false,
  185. confirmData: {
  186. title: '',
  187. content: ''
  188. },
  189. confirmType: ''
  190. }
  191. },
  192. computed: {
  193. isRefund() {
  194. return this.data.refund_status != 0
  195. },
  196. statusDisplay() {
  197. let result = {}
  198. if (this.isRefund) {
  199. return {
  200. title: this.data.refund_status_name,
  201. tips: this.data.refund_status_name,
  202. }
  203. }
  204. switch (this.data.status) {
  205. case 1:
  206. case 2:
  207. result = {
  208. title: '等待买家付款',
  209. tips: '逾期未付款,订单将自动取消',
  210. icon: 'order-icon1.png'
  211. }
  212. break;
  213. case 3:
  214. result = {
  215. title: '等待卖家发货',
  216. tips: '预计支付成功后48小时内发货',
  217. icon: 'order-icon2.png'
  218. }
  219. break;
  220. case 4:
  221. result = {
  222. title: '卖家已发货',
  223. tips: this.data.status_name,
  224. icon: 'order-icon3.png'
  225. }
  226. break;
  227. case 6:
  228. case 9:
  229. result = {
  230. title: '买家已确认收货',
  231. tips: `确认时间:${this.data.receive_at}`,
  232. icon: 'order-icon3.png'
  233. }
  234. break;
  235. }
  236. return result
  237. }
  238. },
  239. onLoad(options) {
  240. this.pageOptions = options
  241. this.orderNo = options.orderNo
  242. let configs = uni.getStorageSync('configs') || {}
  243. this.bgImg = configs.shop_bgimg
  244. this.getDetail()
  245. },
  246. onShow() {
  247. const topData = uni.getMenuButtonBoundingClientRect()
  248. this.topData.top = topData.top
  249. this.topData.height = topData.height
  250. },
  251. methods: {
  252. confirmHandler() {
  253. // 确认弹框
  254. if (this.confirmType == 'cancelOrder') {
  255. // 取消订单
  256. this.$api.cancelOrder({ order_no: this.data.order_no }).then(res => {
  257. this.confirmShow = false
  258. this.getDetail()
  259. }).catch(() => {
  260. this.confirmShow = false
  261. })
  262. } else if (this.confirmType == 'confirm') {
  263. this.$api.confirmOrder({ order_no: this.data.order_no }).then(res => {
  264. this.confirmShow = false
  265. this.getDetail()
  266. }).catch(() => {
  267. this.confirmShow = false
  268. })
  269. } else if (this.confirmType == 'cancelAfter') {
  270. this.$api.cancelAfterSales({ order_no: this.data.order_no }).then(res => {
  271. this.confirmShow = false
  272. this.getDetail()
  273. }).catch(() => {
  274. this.confirmShow = false
  275. })
  276. }
  277. },
  278. toAfterSales() {
  279. uni.navigateTo({
  280. url: `/subPages/afterSales/afterSales?orderNo=${this.data.order_no}`
  281. })
  282. },
  283. toPay() {
  284. // 立即付款
  285. this.$toWechatPay(this.data.order_no)
  286. },
  287. cancelOrder() {
  288. if (this.data.status == 3) {
  289. uni.navigateTo({
  290. url: `/subPages/cancelOrder/cancelOrder?orderNo=${this.data.order_no}`
  291. })
  292. } else {
  293. this.showReson = true
  294. }
  295. },
  296. cancelAfter() {
  297. this.confirmShow = true
  298. this.confirmType = 'cancelAfter'
  299. this.confirmData = {
  300. title: '取消申请',
  301. content: '确认取消申请吗?'
  302. }
  303. },
  304. cancelConfirm(data) {
  305. console.log(7999, data)
  306. this.confirmShow = true
  307. this.confirmType = 'cancelOrder'
  308. this.confirmData = {
  309. title: '取消订单',
  310. content: '确认取消订单吗?'
  311. }
  312. },
  313. confirm() {
  314. this.confirmShow = true
  315. this.confirmType = 'confirm'
  316. this.confirmData = {
  317. title: '确认收货',
  318. content: '确认收货码?'
  319. }
  320. },
  321. getDetail() {
  322. this.$api.orderDetail({ order_no: this.orderNo }).then(res => {
  323. this.data = res.data
  324. this.goodsList = res.data.items || []
  325. this.truckData = res.data.truck
  326. this.refundData = res.data.refund || {}
  327. if (this.refundData.refund_img) {
  328. this.refundData.refund_img = JSON.parse(this.refundData.refund_img)
  329. }
  330. })
  331. },
  332. toBack() {
  333. uni.navigateBack({
  334. delta: 1 // 返回上一级页面
  335. });
  336. }
  337. }
  338. }
  339. </script>
  340. <style lang="scss" scoped>
  341. .common-page {
  342. height: 100vh;
  343. overflow-y: auto;
  344. // padding: 20rpx;
  345. color: #2C2C2C;
  346. padding-bottom: 188rpx;
  347. box-sizing: border-box;
  348. }
  349. .album {
  350. @include flex;
  351. align-items: flex-start;
  352. &__avatar {
  353. background-color: $u-bg-color;
  354. padding: 5px;
  355. border-radius: 3px;
  356. }
  357. &__content {
  358. margin-left: 10px;
  359. flex: 1;
  360. }
  361. }
  362. .success-con {
  363. padding: 0 50rpx 0 40rpx;
  364. }
  365. .content-box {
  366. padding: 20rpx;
  367. }
  368. .navbar-box {
  369. position: relative;
  370. }
  371. .good-card {
  372. padding: 38rpx 22rpx;
  373. color: #7A7A7A;
  374. ::v-deep {
  375. .u-textarea {
  376. background: #F6F6F6;
  377. border-radius: 12rpx 12rpx 12rpx 12rpx;
  378. border: none;
  379. padding: 18rpx;
  380. .u-textarea__count {
  381. background-color: transparent !important;
  382. }
  383. }
  384. }
  385. }
  386. .goods-list {
  387. margin: 0 30rpx;
  388. padding: 30rpx 0;
  389. border-bottom: 1rpx solid #F5F5F5;
  390. }
  391. .goods-total {
  392. justify-content: flex-end;
  393. margin: 27rpx 20rpx;
  394. }
  395. </style>