detail.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <!-- #ifdef H5 -->
  3. <view>
  4. <Loading
  5. :type="3"
  6. :loadStatus="loadStatus"
  7. :showText="errorText"
  8. />
  9. <zj-page-layout
  10. v-if="detail"
  11. :hasFooter="true"
  12. :isScroll="true"
  13. :refresherTriggered="refresherTriggered"
  14. @refresherrefresh="refresherrefresh">
  15. <view class="address-container">
  16. <view class="icon"><text class="iconfont icon-dingwei1"></text></view>
  17. <view class="hasdata">
  18. <view class="name">{{detail.userName}}<text>{{detail.phone}}</text></view>
  19. <view class="address ellipsis-2">{{detail.province}}{{detail.city}}{{detail.area}}{{detail.street}}{{detail.address}}</view>
  20. </view>
  21. </view>
  22. <view class="goods-container">
  23. <view class="title">商品信息</view>
  24. <view class="goods">
  25. <image :src="imageUrl + detail.goodsPicUrl" mode="aspectFill"></image>
  26. <view class="main">
  27. <view class="name">{{detail.goodsTitle}}</view>
  28. <view class="des">{{detail.content}}</view>
  29. <view class="price"><text>{{detail.goodsAmount | priceFilter2}}</text>数量:{{detail.num}}</view>
  30. </view>
  31. </view>
  32. <view class="total">订单总金额<text>{{detail.price | priceFilter2}}</text></view>
  33. </view>
  34. <view class="order-container">
  35. <view class="title">订单信息</view>
  36. <view class="row">订单编号:{{detail.orderId}}</view>
  37. <view class="row">创建时间:{{detail.createTime}}</view>
  38. <view class="row">付款时间:{{detail.payTime}}</view>
  39. <view class="row">支付方式:{{detail.payType | payTypeFilter}}</view>
  40. <view class="row">支付单号:{{detail.transactionId}}</view>
  41. <view class="row">发货时间:{{detail.logisticsTime}}</view>
  42. <view class="row">收货时间:{{detail.completeTime}}</view>
  43. </view>
  44. <template slot="footer">
  45. <view class="bottom-container">
  46. <block v-if="detail.status == 'WAIT'">
  47. <u-button text="取消订单" shape="circle" @click="cancelOrder(detail.orderId)"></u-button>
  48. <u-button text="去支付" shape="circle" type="primary" plain @tap="toPay(detail.goodsId, detail.orderId)"></u-button>
  49. </block>
  50. <block v-if="detail.status == 'WAIT_SEND'">
  51. <u-button text="联系卖家" shape="circle" @tap="toContact(detail.goodsId)"></u-button>
  52. </block>
  53. <block v-if="~['SEND', 'COMPLETE'].indexOf(detail.status)">
  54. <u-button text="查看物流" shape="circle" @tap="toLogistics(detail.logisticsNum)"></u-button>
  55. </block>
  56. <block v-if="detail.status == 'SEND'">
  57. <u-button text="确认收货" shape="circle" type="primary" plain @tap="confirmReceipt(detail.orderId)"></u-button>
  58. </block>
  59. <block v-if="detail.status == 'COMPLETE'">
  60. <u-button text="申请售后" shape="circle" @tap="toReturn(detail.orderId)"></u-button>
  61. </block>
  62. </view>
  63. </template>
  64. </zj-page-layout>
  65. </view>
  66. <!-- #endif -->
  67. <!-- #ifndef H5 -->
  68. <web-view :src="webViewHref('/pages/mine/myBuy/detail', pam)" @message="crossPage.$listener"></web-view>
  69. <!-- #endif -->
  70. </template>
  71. <script>
  72. // #ifdef H5
  73. export default {
  74. filters: {
  75. payTypeFilter(val) {
  76. const MAP = {
  77. WECHAT: '微信支付'
  78. }
  79. return MAP[val];
  80. }
  81. },
  82. data() {
  83. return {
  84. orderId: null,
  85. detail: null,
  86. imageUrl: this.$imageUrl,
  87. loadStatus: 0,
  88. errorText: '',
  89. refresherTriggered: false,
  90. }
  91. },
  92. onLoad({orderId}) {
  93. this.orderId = orderId;
  94. this.getDetail();
  95. },
  96. methods: {
  97. getDetail() {
  98. this.$api.postJson('/orderPay/detail', {
  99. orderId: this.orderId
  100. }).then(res => {
  101. this.detail = res.data;
  102. this.loadStatus = 0;
  103. }).catch(res => {
  104. this.errorText = res.message;
  105. this.loadStatus = 2;
  106. }).finally(res => {
  107. this.refresherTriggered = false;
  108. })
  109. },
  110. refresherrefresh() {
  111. this.refresherTriggered = true;
  112. this.getDetail();
  113. },
  114. // 取消支付
  115. cancelOrder(orderId) {
  116. this.$modal({
  117. content: '确认取消支付吗?'
  118. }).then(() => {
  119. this.$api.postJson('/orderPay/wait/notPay', {
  120. userId: this.$store.state.user.userId,
  121. orderId: orderId,
  122. }).then(res => {
  123. this.$successToast();
  124. this.getDetail();
  125. })
  126. }).catch(() => {})
  127. },
  128. // 确认收货
  129. confirmReceipt(orderId) {
  130. this.$modal({
  131. content: '确定要确认收货吗?'
  132. }).then(() => {
  133. this.$api.postJson('/orderPay/confirm', {
  134. userId: this.$store.state.user.userId,
  135. orderId: orderId,
  136. }).then(res => {
  137. this.$successToast();
  138. this.refreshLish();
  139. })
  140. }).catch(() => {})
  141. },
  142. // 查看物流
  143. toLogistics(logisticsNum) {
  144. this.$navToPage({
  145. url: `/pages/mine/myBuy/logistics?logisticsNum=${logisticsNum}`
  146. })
  147. },
  148. // 去支付
  149. toPay(goodsId, orderId) {
  150. this.$navToPage({
  151. url: `/pages/goods/order?goodsId=${goodsId}&orderId=${orderId}`
  152. })
  153. },
  154. // 去申请售后
  155. toReturn(orderId) {
  156. this.$navToPage({
  157. url: `/pages/mine/myBuy/return?orderId=${orderId}`
  158. })
  159. },
  160. // 去联系
  161. toContact(goodsId) {
  162. this.$navToPage({
  163. url: `/pages/message/msgView?goodsId=${goodsId}`
  164. })
  165. },
  166. }
  167. }
  168. // #endif
  169. // #ifndef H5
  170. export default {
  171. data() {
  172. return {
  173. pam: {},
  174. }
  175. },
  176. onLoad(pam) {
  177. this.pam = pam;
  178. },
  179. }
  180. // #endif
  181. </script>
  182. <style lang="scss" scoped>
  183. .address-container {
  184. background: #FFFFFF;
  185. display: flex;
  186. align-items: center;
  187. height: 150rpx;
  188. padding: 0 20rpx;
  189. margin-top: 30rpx;
  190. .icon {
  191. width: 52rpx;
  192. height: 52rpx;
  193. border-radius: 50%;
  194. background: $theme-color;
  195. display: flex;
  196. flex-shrink: 0;
  197. justify-content: center;
  198. align-items: center;
  199. margin-right: 20rpx;
  200. .iconfont {
  201. font-size: 36rpx;
  202. color: #ffffff;
  203. }
  204. }
  205. .hasdata {
  206. .name {
  207. font-size: 32rpx;
  208. color: #333333;
  209. text {
  210. color: #999999;
  211. font-size: 28rpx;
  212. margin-left: 16rpx;
  213. }
  214. }
  215. .address {
  216. font-size: 28rpx;
  217. color: #666666;
  218. line-height: 34rpx;
  219. margin-top: 10rpx;
  220. }
  221. }
  222. }
  223. .goods-container {
  224. background: #ffffff;
  225. margin-top: 30rpx;
  226. padding: 30rpx 30rpx 0;
  227. .title {
  228. font-weight: 500;
  229. }
  230. .goods {
  231. display: flex;
  232. padding: 30rpx 0;
  233. image {
  234. width: 120rpx;
  235. height: 120rpx;
  236. }
  237. .main {
  238. flex: 1;
  239. margin-left: 20rpx;
  240. .name {
  241. font-size: 32rpx;
  242. }
  243. .des {
  244. margin-top: 12rpx;
  245. font-size: 28rpx;
  246. color: $reg-font;
  247. }
  248. .price {
  249. margin-top: 12rpx;
  250. text {
  251. color: $assist-color;
  252. font-weight: 500;
  253. font-size: 32rpx;
  254. margin-right: 12rpx;
  255. }
  256. }
  257. }
  258. }
  259. .total {
  260. border-top: 1px solid #eaeaea;
  261. height: 80rpx;
  262. display: flex;
  263. align-items: center;
  264. justify-content: end;
  265. font-size: 28rpx;
  266. text {
  267. margin-left: 12rpx;
  268. color: $assist-color;
  269. }
  270. }
  271. }
  272. .order-container {
  273. background: #ffffff;
  274. margin-top: 30rpx;
  275. padding: 30rpx;
  276. .title {
  277. font-weight: 500;
  278. margin-bottom: 20rpx;
  279. }
  280. .row {
  281. margin-top: 12rpx;
  282. font-size: 28rpx;
  283. text {
  284. color: $assist-color;
  285. }
  286. }
  287. }
  288. .bottom-container {
  289. padding: 20rpx 30rpx;
  290. display: flex;
  291. align-items: center;
  292. justify-content: flex-end;
  293. .u-button {
  294. width: auto;
  295. height: 60rpx;
  296. margin: 0;
  297. margin-left: 20rpx;
  298. }
  299. }
  300. </style>