exchange_order_details.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view>
  3. <view class="order-details">
  4. <view class="header-bg"></view>
  5. <view class="main">
  6. <view class="header">
  7. <view class="item" v-if="orderDetail.order_status == 0">
  8. <view class="white lg m-b-10">等待买家付款</view>
  9. </view>
  10. <view class="item" v-if="orderDetail.order_status == 1">
  11. <view class="white lg m-b-10">待发货</view>
  12. <view class="white sm">您的商品正在打包中,请耐心等待…</view>
  13. </view>
  14. <view class="item" v-if="orderDetail.order_status == 2">
  15. <view class="white lg m-b-10">待收货</view>
  16. <view class="white sm">您的商品正在路中,请耐心等待…</view>
  17. </view>
  18. <view class="item" v-if="orderDetail.order_status == 3">
  19. <view class="white lg m-b-10">已完成</view>
  20. <view class="white sm">商品已签收,期待再次购买!</view>
  21. </view>
  22. <view class="item" v-if="orderDetail.order_status == 4">
  23. <view class="white lg m-b-10">订单已关闭</view>
  24. <!-- <view class="white sm">原因:超时未支付</view> -->
  25. </view>
  26. </view>
  27. <view class="address-wrap flex contain">
  28. <image class="icon-md m-r-20" src="/static/images/icon_address.png"></image>
  29. <view class="address">
  30. <view>
  31. <text class="name md m-r-10">{{orderDetail.consignee}}</text>
  32. <text class="phone md">{{orderDetail.mobile}}</text>
  33. <view class="area sm m-t-10 lighter">{{orderDetail.delivery_address}}</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="goods contain">
  38. <view class="flex">
  39. <u-image :src="orderDetail.goods.image" border-radius="10" width="160" height="160"></u-image>
  40. <view class="goods-info flex-1 m-l-20">
  41. <view class="goods-name line-2">{{ orderDetail.goods.name }}</view>
  42. <view class="flex row-between">
  43. <view class="goods-price primary m-t-10">
  44. <price-format :show-subscript="false" :first-size="36" :second-size="24"
  45. :price="orderDetail.goods.need_integral" />
  46. <text class="xs">券</text>
  47. <block v-if="orderDetail.goods.exchange_way === 2">
  48. <text>+</text>
  49. <price-format :show-subscript="false" :first-size="36" :second-size="24"
  50. :price="orderDetail.goods.need_money" />
  51. <text class="xs">元</text>
  52. </block>
  53. </view>
  54. <view class="lighter">×{{orderDetail.total_num}}</view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="price contain">
  60. <view class="flex row-between">
  61. <view>商品金额</view>
  62. <view class="black">
  63. <price-format :show-subscript="false" :price="orderDetail.order_integral" />
  64. <text class="xs">券</text>
  65. <block v-if="orderDetail.goods_price > 0">
  66. <text>+</text>
  67. <price-format :show-subscript="false" :price="orderDetail.goods_price" />
  68. <text class="xs">元</text>
  69. </block>
  70. </view>
  71. </view>
  72. <view class="flex row-between" v-if="orderDetail.shipping_price">
  73. <view>运费</view>
  74. <view class="black">+
  75. <price-format :price="orderDetail.shipping_price"></price-format>
  76. </view>
  77. </view>
  78. <view class="flex row-right">
  79. <view class="lighter">实付金额:</view>
  80. <view class="primary">
  81. <price-format :show-subscript="false" :first-size="36" :second-size="24"
  82. :price="orderDetail.order_integral" />
  83. <text class="xs">券</text>
  84. <block v-if="orderDetail.order_amount > 0">
  85. <text>+</text>
  86. <price-format :show-subscript="false" :first-size="36" :second-size="24"
  87. :price="orderDetail.order_amount" />
  88. <text class="xs">元</text>
  89. </block>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="order-info contain">
  94. <view class="item flex" style="align-items: flex-start;">
  95. <view class="title">买家留言</view>
  96. <view class="black">{{orderDetail.user_remark || '无'}}</view>
  97. </view>
  98. </view>
  99. <view class="order-info contain">
  100. <view class="item flex">
  101. <view class="title">订单编号</view>
  102. <view class="black">{{orderDetail.order_sn}}</view>
  103. </view>
  104. <view class="item flex">
  105. <view class="title">支付方式</view>
  106. <view class="black">{{orderDetail.pay_way}}</view>
  107. </view>
  108. <view class="item flex">
  109. <view class="title">下单时间</view>
  110. <view class="black">{{orderDetail.create_time}}</view>
  111. </view>
  112. <view v-if="orderDetail.pay_time" class="item flex">
  113. <view class="title">付款时间</view>
  114. <view class="black">{{orderDetail.pay_time}}</view>
  115. </view>
  116. <view v-if="orderDetail.shipping_time" class="item flex">
  117. <view class="title">发货时间</view>
  118. <view class="black">{{orderDetail.shipping_time }}</view>
  119. </view>
  120. <view v-if="orderDetail.confirm_take_time" class="item flex">
  121. <view class="title">成交时间</view>
  122. <view class="black">{{orderDetail.confirm_take_time }}</view>
  123. </view>
  124. <view v-if="orderDetail.cancel_time" class="item flex">
  125. <view class="title">关闭时间</view>
  126. <view class="black">{{orderDetail.cancel_time}}</view>
  127. </view>
  128. </view>
  129. <view class="footer bg-white flex fixed"
  130. v-if="orderDetail.btns.cancel_btn || orderDetail.btns.delivery_btn || orderDetail.btns.confirm_btn || orderDetail.btns.del_btn || orderDetail.btns.pay_btn">
  131. <view class="flex-1"></view>
  132. <view v-if="orderDetail.btns.cancel_btn">
  133. <button size="sm" class="plain br60" hover-class="none" @tap="handleOrder(0)">取消订单</button>
  134. </view>
  135. <router-link v-if="orderDetail.btns.delivery_btn"
  136. :to="{path: '/bundle/pages/goods_logistics/goods_logistics', query: {id: orderDetail.id, type: 'integral'}}">
  137. <button size="sm" class="plain br60" hover-class="none">查看物流</button>
  138. </router-link>
  139. <view v-if="orderDetail.btns.confirm_btn" class="m-l-20">
  140. <button size="sm" class="plain br60 primary red" hover-class="none"
  141. @tap.stop="handleOrder(2)">确认收货</button>
  142. </view>
  143. <view v-if="orderDetail.btns.del_btn">
  144. <button size="sm" class="plain br60" hover-class="none" @tap="handleOrder(1)">删除订单</button>
  145. </view>
  146. <view class="m-l-20" v-if="orderDetail.btns.pay_btn">
  147. <button size="sm" class="bg-primary br60 white" @tap="payNow">立即付款</button>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. <loading-view v-if="isFirstLoading"></loading-view>
  153. <order-dialog ref="orderDialog" :orderId="orderDetail.id" :type="type" @confirm="confirmDialog"></order-dialog>
  154. <float-tab></float-tab>
  155. </view>
  156. </template>
  157. <script>
  158. import {
  159. getIntegralOrderDetail,
  160. cancelIntegralOrder,
  161. delIntegralOrder,
  162. confirmIntegralOrder
  163. } from '@/api/activity';
  164. export default {
  165. data() {
  166. return {
  167. orderDetail: {
  168. goods: {},
  169. btns: {}
  170. },
  171. team: {},
  172. isFirstLoading: true,
  173. type: 0,
  174. showCancel: "",
  175. showLoading: false
  176. };
  177. },
  178. onLoad: function(options) {
  179. const {
  180. id
  181. } = this.$Route.query;
  182. this.id = id;
  183. this.getOrderDetailFun();
  184. uni.$on('payment', this.payCallback)
  185. },
  186. onUnload() {
  187. uni.$off('payment', this.payCallback)
  188. },
  189. methods: {
  190. payCallback(params) {
  191. setTimeout(() => {
  192. if (params.result) {
  193. this.$toast({
  194. title: "支付成功"
  195. })
  196. this.getOrderDetailFun()
  197. } else {
  198. this.$toast({
  199. title: "支付失败"
  200. })
  201. }
  202. }, 500)
  203. },
  204. async confirmDialog() {
  205. const {
  206. type,
  207. id
  208. } = this
  209. let res = null
  210. switch (type) {
  211. case 0:
  212. res = await cancelIntegralOrder(id);
  213. break;
  214. case 1:
  215. res = await delIntegralOrder(id);
  216. break;
  217. case 2:
  218. res = await confirmIntegralOrder(id);
  219. break;
  220. }
  221. if (res.code == 1) {
  222. uni.$emit("refreshorder")
  223. if ([0, 2].includes(type)) {
  224. this.getOrderDetailFun();
  225. } else if (type == 1) {
  226. setTimeout(() => {
  227. uni.navigateBack()
  228. }, 2000)
  229. }
  230. }
  231. },
  232. dialogOpen() {
  233. this.$refs.orderDialog.open()
  234. },
  235. handleOrder(type) {
  236. this.type = type
  237. this.$nextTick(() => {
  238. this.dialogOpen();
  239. });
  240. },
  241. payNow() {
  242. this.$Router.push({
  243. path: '/pages/payment/payment',
  244. query: {
  245. from: 'integral',
  246. order_id: this.id
  247. }
  248. })
  249. },
  250. getOrderDetailFun() {
  251. getIntegralOrderDetail(this.id).then(res => {
  252. if (res.code == 1) {
  253. this.orderDetail = res.data
  254. this.$nextTick(() => {
  255. this.isFirstLoading = false
  256. });
  257. } else {
  258. setTimeout(() => uni.navigateBack(), 1500)
  259. }
  260. });
  261. },
  262. },
  263. computed: {
  264. }
  265. };
  266. </script>
  267. <style lang="scss">
  268. .order-details {
  269. position: relative;
  270. padding-bottom: calc(120rpx + env(safe-area-inset-bottom));
  271. .contain {
  272. margin: 0 20rpx 20rpx;
  273. border-radius: 14rpx;
  274. background-color: #fff;
  275. }
  276. .header-bg {
  277. position: absolute;
  278. top: 0;
  279. width: 100%;
  280. height: 200rpx;
  281. background-color: $-color-primary;
  282. z-index: 0;
  283. }
  284. .header {
  285. padding: 24rpx 40rpx;
  286. }
  287. .main {
  288. position: relative;
  289. z-index: 1;
  290. }
  291. .goods {
  292. padding: 30rpx 24rpx;
  293. .goods-name {
  294. line-height: 40rpx;
  295. height: 80rpx;
  296. }
  297. }
  298. .address-wrap {
  299. height: 164rpx;
  300. padding: 0 24rpx;
  301. }
  302. .order-info {
  303. padding: 12rpx 0;
  304. .item {
  305. padding: 12rpx 24rpx;
  306. .title {
  307. width: 180rpx;
  308. flex: none;
  309. }
  310. }
  311. }
  312. .price {
  313. padding: 24rpx 0;
  314. &>view {
  315. height: 60rpx;
  316. padding: 0 24rpx;
  317. }
  318. }
  319. .footer {
  320. position: fixed;
  321. bottom: 0;
  322. left: 0;
  323. right: 0;
  324. height: 100rpx;
  325. padding: 0 24rpx;
  326. box-sizing: content-box;
  327. padding-bottom: env(safe-area-inset-bottom);
  328. .plain {
  329. border: 1px solid #BBBBBB;
  330. &.red {
  331. border: 1px solid $-color-primary;
  332. }
  333. }
  334. }
  335. }
  336. </style>