orderDetails.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <view>
  3. <view class="contentBox" @click="expressageClick(form)">
  4. <view style="width: 100%;margin: 0 auto;">
  5. <u-cell-group :border="false">
  6. <u-cell :border="false" center title="快递信息" arrow-direction="down">
  7. <view slot="icon" style="width: 10rpx;height: 35rpx;background-color: #E75F37;"></view>
  8. </u-cell>
  9. </u-cell-group>
  10. <!-- <view class="textBox">
  11. <view>快递公司:</view>
  12. <view>{{form.logisticsCorpName || ''}}</view>
  13. </view>
  14. <view class="textBox">
  15. <view>快递单号:</view>
  16. <view>{{form.expressNo || ''}}</view>
  17. </view> -->
  18. <view class="textBox">
  19. <view>收货人:</view>
  20. <view>{{form.contacts}}</view>
  21. </view>
  22. <view class="textBox">
  23. <view>收货地址:</view>
  24. <view>{{form.recAddress || ''}}</view>
  25. </view>
  26. <view class="textBox">
  27. <view>货运编号:</view>
  28. <view>{{form.expressNo || ''}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="contentBox">
  33. <view style="width: 100%;margin: 0 auto;">
  34. <u-cell-group :border="false">
  35. <u-cell :border="false" center title="订单信息" arrow-direction="down">
  36. <view slot="icon" style="width: 10rpx;height: 35rpx;background-color: #E75F37;"></view>
  37. </u-cell>
  38. </u-cell-group>
  39. <view class="textBox">
  40. <view>订单编号:</view>
  41. <view>{{form.srcOrdNo}}</view>
  42. </view>
  43. <view class="textBox">
  44. <view>下单时间:</view>
  45. <view>{{form.createTime}}</view>
  46. </view>
  47. <view class="textBox">
  48. <view>商品金额:</view>
  49. <view>{{form.salesAmount}}</view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="contentBox">
  54. <u-cell-group :border="false">
  55. <u-cell :border="false" center title="商品信息" arrow-direction="down">
  56. <view slot="icon" style="width: 10rpx;height: 35rpx;background-color: #E75F37;"></view>
  57. </u-cell>
  58. </u-cell-group>
  59. <u-cell v-for="(item,index) in form.orderItemsList" :key="index"
  60. :border="form.orderItemsList.length == Number(index+1)?false:true">
  61. <view slot="label">
  62. <u-row>
  63. <u-col span="2.9">
  64. <u--image :showLoading="true" mode='aspectFit'
  65. :src="item.url"
  66. width="150rpx" height="150rpx" radius="10">
  67. </u--image>
  68. </u-col>
  69. <u-col span="9.1">
  70. <view
  71. style="font-size: 36rpx;width: 500rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
  72. {{item.goodsName}}
  73. </view>
  74. <view style="display: flex;justify-content: space-between;">
  75. <view style="color: #707070;">单价:¥{{item.price}}</view>
  76. <view style="color: #707070;">
  77. 数量:{{item.goodsNum?parseFloat(item.goodsNum):''}}</view>
  78. </view>
  79. <view style="display: flex;justify-content: space-between;">
  80. <view style="color: #707070;">金额:¥{{item.totalAmount}}</view>
  81. </view>
  82. </u-col>
  83. </u-row>
  84. </view>
  85. </u-cell>
  86. </view>
  87. <view class="contentBox">
  88. <view style="width: 100%;margin: 0 auto;">
  89. <u-cell-group :border="false">
  90. <u-cell :border="false" center title="付款信息" arrow-direction="down">
  91. <view slot="icon" style="width: 10rpx;height: 35rpx;background-color: #E75F37;"></view>
  92. </u-cell>
  93. </u-cell-group>
  94. <view class="textBox">
  95. <view>本次付款:</view>
  96. <view>{{form.totalMoney}}</view>
  97. </view>
  98. </view>
  99. </view>
  100. <view style="display: flex;">
  101. <!-- <debounce-button v-if="form.status=='已发货'" size="mini" style="width: 250rpx;" bgColor='#FFF1E6' color='#03803B'>确认收货</debounce-button>-->
  102. <debounce-button v-if="form.status=='已收货'||form.status=='已取消'||form.status=='申请退货'" size="mini" style="width: 250rpx;" bgColor='#e43d33'>申请退货</debounce-button>
  103. </view>
  104. </view>
  105. </template>
  106. <script>
  107. import {
  108. appDetail,
  109. appShareDetail,
  110. checkOrder,
  111. appUpdate
  112. } from '@/api/me/myOrder.js'
  113. export default {
  114. data() {
  115. return {
  116. order: "",
  117. isDisabled: true,
  118. form: {
  119. orderItemsList: []
  120. },
  121. roleaName: '', // 用户权限
  122. }
  123. },
  124. onLoad(onLoad) {
  125. // 获取当前登录人的用户信息
  126. this.roleaName = uni.getStorageSync('userInfo').role_name
  127. uni.showLoading({
  128. title: '加载中',
  129. mask: true
  130. });
  131. let _this = this
  132. if (uni.getStorageSync('whether_openShare') == 1) {
  133. appShareDetail({
  134. id: onLoad.id
  135. }).then(res => {
  136. this.form = res.data
  137. uni.hideLoading();
  138. }).catch(err => {
  139. uni.hideLoading();
  140. })
  141. } else {
  142. appDetail({
  143. id: onLoad.id
  144. }).then(res => {
  145. this.form = res.data
  146. this.form.orderItemsList.map(item => {
  147. item.totalAmount = item.price * item.goodsNum
  148. })
  149. if (this.form.status == '已发货') {
  150. _this.isDisabled = true;
  151. _this.order = "确认收货";
  152. } else if (this.form.status == '录入' || this.form.status == '退款中' || this.form.status ==
  153. '已取消' ||
  154. this.form.status == '退款请核' || this.form.status == '待发货' || this.form.status == '待确认') {
  155. _this.order = "申请退款";
  156. _this.isDisabled = true;
  157. } else {
  158. _this.isDisabled = false;
  159. }
  160. if (this.form.status == '退款请核') {
  161. _this.isDisabled = false
  162. }
  163. uni.hideLoading();
  164. }).catch(err => {
  165. uni.hideLoading();
  166. })
  167. }
  168. },
  169. methods: {
  170. confirmReceipt() {
  171. console.log(1);
  172. },
  173. // 快递信息点击事件
  174. expressageClick(form) {
  175. if (form.shipType === '快递') {
  176. let reg = /.+?(省|市|自治区|自治州|县|区)/g; // 省市区的正则
  177. let from = '';
  178. let to = '';
  179. // 出发城市
  180. if (form.shippingAddress != null) {
  181. let fromList = form.shippingAddress.match(reg);
  182. for (var i = 0; i < fromList.length; i++) {
  183. from += fromList[i]
  184. if (fromList.length - 1 > i) {
  185. from += '-'
  186. }
  187. }
  188. }
  189. // 目的城市
  190. if (form.recAddress != null) {
  191. let toList = form.recAddress.match(reg);
  192. for (var i = 0; i < toList.length; i++) {
  193. to += toList[i]
  194. if (toList.length - 1 > i) {
  195. to += '-'
  196. }
  197. }
  198. }
  199. // 地点
  200. let city = '';
  201. if (from != '') {
  202. city += '&from=' + from;
  203. }
  204. if (to != '') {
  205. city += '&to=' + to;
  206. }
  207. // com: '查询的快递公司的编码',
  208. // num: '查询的快递单号',
  209. // phone: '收件人或寄件人的手机号或固话',
  210. // from: '出发地城市,省-市-区',
  211. // to: '目的地城市,省-市-区'
  212. // url: './transportation?id=' + form.id +'&com=' + form.courierCorporation + '&num=' + form.courierNumber +
  213. // '&phone=' + form.corpTel + city
  214. // uni.navigateTo({
  215. // url: './transportation?id=' + form.id +
  216. // '&com=shentong&num=773236818683545&phone=15568850829&to=山东省-青岛市-李沧区'
  217. // });
  218. uni.navigateTo({
  219. url: './transportation?id=' + form.id + '&com=' + form.logisticsCorpId + '&num=' + form
  220. .expressNo +
  221. '&phone=' + form.phone + city
  222. });
  223. }
  224. },
  225. //申请退款按钮
  226. requestRefund() {
  227. let _this = this
  228. uni.showModal({
  229. title: '提示',
  230. content: "确认退款?",
  231. success: function(rest) {
  232. if (rest.confirm) {
  233. uni.showLoading({
  234. title: '退款中',
  235. mask: true
  236. });
  237. checkOrder({
  238. id: _this.form.id,
  239. pageLabel: "销售订单",
  240. pageStatus: "this.$store.getters.domSaleStatus",
  241. url: "/tirePartsMall/salesManagement/saleOrder/index",
  242. }).then(res => {
  243. uni.showToast({
  244. icon: "none",
  245. title: '提交申请成功',
  246. mask: true
  247. });
  248. setTimeout(function() {
  249. // appDetail({
  250. // id: res.data.id
  251. // }).then(res => {
  252. // this.form = res.data
  253. // console.log(this.form);
  254. // }).catch(err => {
  255. // uni.hideLoading();
  256. // })
  257. if (res.code == 200) {
  258. _this.isDisabled = false
  259. }
  260. uni.hideLoading();
  261. }, 1000);
  262. })
  263. }
  264. }
  265. })
  266. },
  267. orderClosing() {
  268. console.log(123);
  269. if (this.order == "申请退款") {
  270. this.requestRefund()
  271. // uni.showLoading({
  272. // title: '退款中',
  273. // mask: true
  274. // });
  275. // checkOrder({
  276. // id: this.form.id,
  277. // pageLabel: "销售订单",
  278. // pageStatus: "this.$store.getters.domSaleStatus",
  279. // url: "/tirePartsMall/salesManagement/saleOrder/index",
  280. // }).then(res => {
  281. // uni.showToast({
  282. // icon: "none",
  283. // title: '提交申请成功',
  284. // mask: true
  285. // });
  286. // let _this = this
  287. // setTimeout(function() {
  288. // // appDetail({
  289. // // id: res.data.id
  290. // // }).then(res => {
  291. // // this.form = res.data
  292. // // console.log(this.form);
  293. // // }).catch(err => {
  294. // // uni.hideLoading();
  295. // // })
  296. // if (res.code == 200) {
  297. // _this.isDisabled = false
  298. // }
  299. // uni.hideLoading();
  300. // }, 1000);
  301. // })
  302. } else {
  303. //确认收货
  304. let this_ = this
  305. uni.showModal({
  306. title: '提示',
  307. content: "是否确认收货",
  308. success: function(rest) {
  309. if (rest.confirm) {
  310. // 用户点击了确认按钮
  311. uni.showLoading({
  312. title: '加载中',
  313. mask: true
  314. });
  315. appUpdate({
  316. id: this_.form.id,
  317. }).then(res => {
  318. uni.showToast({
  319. icon: "none",
  320. title: '确认收货成功',
  321. mask: true
  322. });
  323. let _this = this
  324. setTimeout(function() {
  325. // appDetail({
  326. // id: res.data.id
  327. // }).then(res => {
  328. // this.form = res.data
  329. // console.log(this.form);
  330. // }).catch(err => {
  331. // uni.hideLoading();
  332. // })
  333. if (res.code == 200) {
  334. this_.isDisabled = false
  335. }
  336. uni.hideLoading();
  337. }, 1000);
  338. })
  339. }
  340. }
  341. })
  342. }
  343. }
  344. }
  345. }
  346. </script>
  347. <style lang="scss" scoped>
  348. .contentBox {
  349. width: 96%;
  350. margin: 20rpx auto;
  351. background-color: #FFFFFF;
  352. border-radius: 20rpx;
  353. // box-shadow: 0 5rpx 14rpx 0 rgba(101, 176, 249, 0.42);
  354. // padding-top: 15rpx;
  355. padding-bottom: 10rpx;
  356. }
  357. .textBox {
  358. padding: 0 15px;
  359. display: flex;
  360. justify-content: space-between;
  361. font-size: 24rpx;
  362. margin-bottom: 10rpx;
  363. align-items: flex-end;
  364. }
  365. </style>