order-refund.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <template>
  2. <app-layout>
  3. <view v-if="isShow">
  4. <!--申请退款-->
  5. <view class="box" v-if="orderDetail.cancel_status == 0">
  6. <view class="goods-info">
  7. <view :key="index" v-for="(item, index) in orderDetail.detail">
  8. <app-jump-button :url="item.goods_info.page_url">
  9. <app-order-goods-info :goods="item.goods_info" :is-last-one="orderDetail.detail.length - 1 !== index" :plugin-data="orderDetail.plugin_data" :plugin-index="index">
  10. </app-order-goods-info>
  11. </app-jump-button>
  12. </view>
  13. </view>
  14. <view class="content">
  15. <view class="content-item">
  16. <span class="label">
  17. 退款原因
  18. </span>
  19. <view class="select-box" @click="cause.visible = true">
  20. <span class="select-label" :class="{'active': form.cause, 'no-active': !form.cause}">
  21. {{form.cause ? cause.list[cause.index] : '请选择'}}
  22. </span>
  23. <image class="arrow-right" src="/static/image/icon/arrow-right.png">
  24. </image>
  25. </view>
  26. </view>
  27. <view class="content-item">
  28. <span class="label">
  29. 退款金额
  30. </span>
  31. <input :placeholder="`最多可退款${orderDetail.refund_price_text}`" class="text price-text" disabled="" placeholder-style="color:#999999;font-size:28rpx;" v-model="orderDetail.refund_price_text">
  32. </input>
  33. </view>
  34. <view class="content-item">
  35. <span class="label">
  36. 备注信息
  37. </span>
  38. <input class="text" placeholder="最多可填200个字" placeholder-style="color:#999999;font-size:28rpx;" v-model="form.remark">
  39. </view>
  40. <view class="content-item">
  41. <span class="label">
  42. 联系方式
  43. </span>
  44. <input class="text" placeholder="请填写联系方式,便于卖家联系你 " placeholder-style="color:#999999;font-size:28rpx;" type="number" v-model="form.mobile">
  45. </view>
  46. </view>
  47. <view class="upload-box">
  48. <view class="label">
  49. 上传凭证
  50. </view>
  51. <app-upload-image :max-num="maxNum" @image-event="imageEvent" background-color="#fff">
  52. </app-upload-image>
  53. </view>
  54. </view>
  55. <!--申请后展示的代码-->
  56. <view v-else="">
  57. <app-order-banner title="待商家审核">
  58. </app-order-banner>
  59. <view class="platform">
  60. {{orderDetail.platform}}
  61. </view>
  62. <view class="goods-box">
  63. <view :key="index" v-for="(item, index) in orderDetail.detail">
  64. <app-jump-button :url="item.goods_info.page_url">
  65. <app-order-goods-info :goods="item.goods_info" style="width:100%;">
  66. </app-order-goods-info>
  67. </app-jump-button>
  68. </view>
  69. </view>
  70. <view class="preferential-box dir-top-nowrap">
  71. <view class="dir-left-nowrap item cross-center" v-if="orderDetail.cancel_data.cause">
  72. <view class="label box-grow-0">
  73. 退款原因:
  74. </view>
  75. <view class="t-small-color box-grow-1">
  76. {{orderDetail.cancel_data.cause}}
  77. </view>
  78. </view>
  79. <view class="dir-left-nowrap item cross-center">
  80. <view class="label box-grow-0">
  81. 退款金额:
  82. </view>
  83. <view class="t-small-color box-grow-1 total_pay_price">
  84. ¥{{orderDetail.total_pay_price}}
  85. </view>
  86. </view>
  87. <view class="dir-left-nowrap item cross-center" v-if="orderDetail.cancel_data.remark">
  88. <view class="label box-grow-0">
  89. 备注信息:
  90. </view>
  91. <view class="t-small-color box-grow-1 text">
  92. {{orderDetail.cancel_data.remark}}
  93. </view>
  94. </view>
  95. <view class="dir-left-nowrap item cross-center" v-if="orderDetail.cancel_data.mobile">
  96. <view class="label box-grow-0">
  97. 联系方式:
  98. </view>
  99. <view class="t-small-color box-grow-1 text">
  100. {{orderDetail.cancel_data.mobile}}
  101. </view>
  102. </view>
  103. <view class="dir-top-nowrap" v-if="orderDetail.cancel_data.image_list.length > 0">
  104. <view class="image-label">
  105. 图片凭证:
  106. </view>
  107. <view class="flex-wrap">
  108. <image @click="previewImage(index)" :key="index" :src="item" class="picture" mode="aspectFill" v-for="(item, index) in orderDetail.cancel_data.image_list">
  109. </image>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. <view style="height: 80rpx;margin-top: 80rpx;">
  115. </view>
  116. <view class="btn-box">
  117. <view @click="cancelApply" class="btn main-center cross-center" v-if="orderDetail.cancel_status == 2">
  118. 撤销申请
  119. </view>
  120. <view @click="formSubmit" class="btn main-center cross-center" v-else="">
  121. 提交
  122. </view>
  123. </view>
  124. <app-select title="退款原因" :is-show="cause.visible" :value="cause.index" :list="cause.list" @confirm="bindPickerChange"></app-select>
  125. </view>
  126. </app-layout>
  127. </template>
  128. <script>
  129. import appOrderGoodsInfo from '../../../components/page-component/app-order-goods-info/app-order-goods-info.vue';
  130. import appUploadImage from "../../../components/basic-component/app-upload-image/app-upload-image.vue";
  131. import appOrderBanner from '../../../components/page-component/app-order-banner/app-order-banner.vue';
  132. import appSelect from "../components/app-select";
  133. export default {
  134. components: {
  135. appOrderGoodsInfo,
  136. appUploadImage,
  137. appOrderBanner,
  138. 'app-select': appSelect,
  139. },
  140. data() {
  141. return {
  142. orderDetail: {},
  143. form: {
  144. image_list: [],
  145. remark: '',
  146. mobile: '',
  147. cause: '',
  148. },
  149. maxNum: 6,
  150. cause: {
  151. list: [],
  152. visible: false,
  153. index: 1,
  154. },
  155. isShow: false,
  156. }
  157. },
  158. methods: {
  159. getOrderDetail() {
  160. let self = this;
  161. self.$showLoading();
  162. self.$request({
  163. url: self.$api.order.detail,
  164. data: {
  165. id: self.order_id,
  166. }
  167. }).then(response => {
  168. self.$hideLoading();
  169. self.isShow = true;
  170. if (response.code === 0) {
  171. self.orderDetail = response.data.detail;
  172. self.setPageTitle();
  173. } else {
  174. uni.showModal({
  175. title: '',
  176. content: response.msg,
  177. showCancel: false,
  178. });
  179. }
  180. }).catch(() => {
  181. self.$hideLoading();
  182. });
  183. },
  184. formSubmit() {
  185. let self = this;
  186. if (!self.form.cause) {
  187. uni.showModal({
  188. title: '',
  189. content: '请选择退款原因',
  190. showCancel: false,
  191. });
  192. return;
  193. }
  194. uni.showModal({
  195. title: '提示',
  196. content: '确认申请退款?',
  197. success: function(res) {
  198. if (res.confirm) {
  199. self.$subscribe(self.orderDetail.template_message_list).then(response => {
  200. self.cancelAction();
  201. }).catch(res => {
  202. self.cancelAction();
  203. });
  204. }
  205. }
  206. });
  207. },
  208. imageEvent(e) {
  209. this.form.image_list = e.imageList;
  210. },
  211. bindPickerChange(e) {
  212. if (!e.is_modal_confirm) {
  213. this.cause.index = e.index;
  214. this.form.cause = this.cause.list[this.cause.index];
  215. }
  216. this.cause.visible = false;
  217. },
  218. cancelAction() {
  219. let self = this;
  220. uni.showLoading({ title: '取消中' });
  221. self.$request({
  222. url: self.$api.order.cancel,
  223. data: {
  224. id: self.orderDetail.id,
  225. cancel_data: JSON.stringify(self.form)
  226. }
  227. }).then(response => {
  228. uni.hideLoading();
  229. if (response.code === 0) {
  230. if (self.sign === 'advance') {
  231. self.$request({
  232. url: self.$api.advance.order_detail,
  233. method: 'get',
  234. data: {
  235. id: self.order_id,
  236. }
  237. }).then(response => {
  238. if (response.code === 0) {
  239. self.orderDetail = response.data.detail;
  240. } else {
  241. uni.showModal({
  242. title: '',
  243. content: response.msg,
  244. showCancel: false,
  245. });
  246. }
  247. })
  248. } else {
  249. self.getOrderDetail();
  250. }
  251. } else {
  252. uni.showModal({
  253. title: '',
  254. content: response.msg,
  255. showCancel: false,
  256. });
  257. }
  258. }).catch(() => {
  259. uni.hideLoading();
  260. });
  261. },
  262. cancelCauseList() {
  263. let self = this;
  264. self.$request({
  265. url: self.$api.order.cancel_cause_list,
  266. }).then(response => {
  267. if (response.code === 0) {
  268. self.cause.list = response.data.list;
  269. } else {
  270. uni.showModal({
  271. title: '',
  272. content: response.msg,
  273. showCancel: false,
  274. });
  275. }
  276. }).catch(() => {
  277. self.$hideLoading();
  278. });
  279. },
  280. cancelApply() {
  281. let self = this;
  282. uni.showLoading({ title: '取消中' });
  283. self.$request({
  284. url: self.$api.order.cancel_apply,
  285. method: "post",
  286. data: {
  287. id: self.order_id
  288. }
  289. }).then(response => {
  290. uni.hideLoading();
  291. if (response.code === 0) {
  292. uni.navigateBack();
  293. } else {
  294. uni.showModal({
  295. title: '',
  296. content: response.msg,
  297. showCancel: false,
  298. });
  299. }
  300. }).catch(() => {
  301. uni.hideLoading();
  302. });
  303. },
  304. // 设置页面标题
  305. setPageTitle() {
  306. let title = '申请退款';
  307. if (this.orderDetail.cancel_status == 2) {
  308. title = '订单退款'
  309. }
  310. uni.setNavigationBarTitle({
  311. title: title
  312. });
  313. },
  314. // 图片预览
  315. previewImage(index) {
  316. let imageList = this.orderDetail.cancel_data.image_list;
  317. uni.previewImage({
  318. current: imageList[index],
  319. urls: imageList
  320. })
  321. },
  322. },
  323. onLoad(options) { this.$commonLoad.onload(options);
  324. this.order_id = options.id;
  325. this.getOrderDetail();
  326. this.cancelCauseList();
  327. }
  328. }
  329. </script>
  330. <style lang="scss" scoped="">
  331. .box {
  332. padding: 24#{rpx};
  333. width: 100%;
  334. .goods-info {
  335. background: #ffffff;
  336. border-radius: 16#{rpx};
  337. padding: 28#{rpx};
  338. }
  339. .content {
  340. margin-top: 24#{rpx};
  341. padding: 0 28#{rpx};
  342. background: #ffffff;
  343. border-radius: 16#{rpx};
  344. display: flex;
  345. flex-direction: column;
  346. .content-item {
  347. display: flex;
  348. height: 88#{rpx};
  349. align-items: center;
  350. border-bottom: 1#{rpx} solid #e2e2e2;
  351. .label {
  352. font-size: 28#{rpx};
  353. color: #353535;
  354. width: 152#{rpx};
  355. }
  356. .text {
  357. color: #353535;
  358. font-size: 28#{rpx};
  359. flex-grow: 1;
  360. }
  361. .price-text {
  362. color: #ff4544;
  363. }
  364. }
  365. .content-item:last-child {
  366. border-bottom: 0;
  367. }
  368. .select-box {
  369. text-align: right;
  370. width: 100%;
  371. .no-active {
  372. color: #999999;
  373. }
  374. .active {
  375. color: #353535;
  376. }
  377. .select-label {
  378. font-size: 28#{rpx};
  379. }
  380. .arrow-right {
  381. width: 12#{rpx};
  382. height: 22#{rpx};
  383. margin-left: 16#{rpx};
  384. }
  385. }
  386. }
  387. .upload-box {
  388. background: #ffffff;
  389. border-radius: 16#{rpx};
  390. padding: 28#{rpx};
  391. display: flex;
  392. flex-direction: column;
  393. margin-top: 24#{rpx};
  394. .label {
  395. font-size: 28#{rpx};
  396. color: #353535;
  397. margin-bottom: 20#{rpx};
  398. }
  399. }
  400. }
  401. .btn-box {
  402. position: fixed;
  403. bottom: 0;
  404. width: 100%;
  405. padding: 24#{rpx};
  406. background: #f7f7f7;
  407. z-index: 999;
  408. .btn {
  409. border-radius: 40#{rpx};
  410. height: 80#{rpx};
  411. background: #ff4544;
  412. padding: 24#{rpx} 0;
  413. color: #ffffff;
  414. font-size: 32#{rpx};
  415. }
  416. }
  417. .shade-box {
  418. width: 100%;
  419. height: 100vh;
  420. background-color: rgba(0, 0, 0, 0.3);
  421. position: absolute;
  422. top: 0;
  423. .list {
  424. position: absolute;
  425. bottom: 0;
  426. width: 100%;
  427. background: #ffffff;
  428. border-top-left-radius: 16#{rpx};
  429. border-top-right-radius: 16#{rpx};
  430. overflow: hidden;
  431. .title {
  432. height: 100#{rpx};
  433. width: 100%;
  434. display: flex;
  435. justify-content: center;
  436. align-items: center;
  437. border-bottom: 1#{rpx} solid #e2e2e2;
  438. }
  439. }
  440. }
  441. .platform {
  442. background: #fff;
  443. border-bottom: 1#{rpx} solid #e2e2e2;
  444. padding: 20#{rpx} 20#{rpx};
  445. margin-top: 20#{rpx};
  446. }
  447. .goods-box {
  448. background: #fff;
  449. padding: 32#{rpx} 24#{rpx};
  450. }
  451. .preferential-box {
  452. background: #fff;
  453. padding: 32#{rpx} 24#{rpx};
  454. margin-top: 20#{rpx};
  455. .item {
  456. margin: 12#{rpx} 15#{rpx} 12#{rpx} 0;
  457. align-items: flex-start;
  458. }
  459. .picture {
  460. width: #{160rpx};
  461. height:#{160rpx};
  462. margin-right: #{14rpx};
  463. margin-bottom:#{14rpx};
  464. }
  465. .label {
  466. margin-right: 15#{rpx};
  467. }
  468. .image-label {
  469. margin: 12#{rpx} 0;
  470. }
  471. .text {
  472. word-break: break-all;
  473. }
  474. .total_pay_price {
  475. color: $uni-important-color-red;
  476. }
  477. }
  478. </style>