refund.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <template>
  2. <app-layout>
  3. <view v-if="is_show">
  4. <view class="refund-box">
  5. <view class="goods-info">
  6. <app-jump-button :url="refundDetail.page_url">
  7. <app-order-goods-info :goods="refundDetail.goods_info" :is-last-one="false" :plugin-data="refundDetail.plugin_data" plugin-index="0">
  8. </app-order-goods-info>
  9. </app-jump-button>
  10. </view>
  11. <view class="content">
  12. <view class="content-item" v-if="form.type == 3">
  13. <span class="label">
  14. 货物状态
  15. </span>
  16. <view class="select-box" @click="goodsStatus.visible = true">
  17. <span :class="{'active': form.goods_status, 'no-active': !form.goods_status}" class="select-label">
  18. {{form.goods_status ? goodsStatus.list[goodsStatus.index] : '请选择'}}
  19. </span>
  20. <image class="arrow-right" src="/static/image/icon/arrow-right.png">
  21. </image>
  22. </view>
  23. </view>
  24. <view class="content-item" v-if="form.type != 2">
  25. <span class="label">
  26. 退款原因
  27. </span>
  28. <view class="select-box" @click="refundList.visible = true">
  29. <span :class="{'active': form.cause, 'no-active': !form.cause}" class="select-label">
  30. {{form.cause ? refundList.list[refundList.index] : '请选择'}}
  31. </span>
  32. <image class="arrow-right" src="/static/image/icon/arrow-right.png">
  33. </image>
  34. </view>
  35. </view>
  36. <view class="content-item" v-if="form.type == 2">
  37. <span class="label">
  38. 换货原因
  39. </span>
  40. <input class="text" placeholder="请输入换货原因" placeholder-style="color:#999999;font-size:28rpx;" v-model="form.cause">
  41. </input>
  42. </view>
  43. <view class="content-item" v-if="form.type != 2">
  44. <span class="label">
  45. 退款金额
  46. </span>
  47. <span v-if="form.refund_price" class="price-label">¥</span>
  48. <input :placeholder="`最多可退款${refundDetail.refund_price_text}`" class="text price-text" placeholder-style="color:#999999;font-size:28rpx;" type="digit" v-model="form.refund_price">
  49. </input>
  50. </view>
  51. <view class="content-item">
  52. <span class="label">
  53. 备注信息
  54. </span>
  55. <input class="text" placeholder="最多可填200个字" placeholder-style="color:#999999;font-size:28rpx;" v-model="form.remark">
  56. </input>
  57. </view>
  58. <view class="content-item">
  59. <span class="label">
  60. 联系方式
  61. </span>
  62. <input class="text" placeholder="请填写联系方式,便于卖家联系你 " placeholder-style="color:#999999;font-size:28rpx;" type="number" v-model="form.mobile">
  63. </input>
  64. </view>
  65. </view>
  66. <view class="upload-box">
  67. <view class="label">
  68. 上传凭证
  69. </view>
  70. <app-upload-image :max-num="maxNum" @image-event="imageEvent" background-color="#fff">
  71. </app-upload-image>
  72. </view>
  73. <view style="height: 80rpx;margin-top: 80rpx;">
  74. </view>
  75. </view>
  76. <view class="btn-box">
  77. <view @click="formSubmit" class="btn main-center cross-center" style="background-color: #F84469;">
  78. 提交
  79. </view>
  80. </view>
  81. <app-select height="264rpx" title="货物状态" :is-show="goodsStatus.visible" :value="goodsStatus.index" :list="goodsStatus.list" @confirm="goodsStatusChange"></app-select>
  82. <app-select title="退款原因" :is-show="refundList.visible" :value="refundList.index" :list="refundList.list" @confirm="refundListChange"></app-select>
  83. </view>
  84. </app-layout>
  85. </template>
  86. <script>
  87. import appOrderGoodsInfo from "../../../components/page-component/app-order-goods-info/app-order-goods-info.vue";
  88. import appUploadImage from "../../../components/basic-component/app-upload-image/app-upload-image.vue";
  89. import appSelect from "../components/app-select";
  90. export default {
  91. components: {
  92. "app-order-goods-info": appOrderGoodsInfo,
  93. 'app-upload-image': appUploadImage,
  94. 'app-select': appSelect,
  95. },
  96. data() {
  97. return {
  98. refundDetail: {},
  99. maxNum: 6, // 图片上传最大数量
  100. is_show: false,
  101. form: {
  102. id: 0,
  103. type: 0,
  104. goods_status: '',
  105. cause: '',
  106. image_list: [],
  107. mobile: '',
  108. remark: '',
  109. refund_price: '',
  110. },
  111. goodsStatus: {
  112. index: 0,
  113. visible: false,
  114. list: [],
  115. },
  116. refundList: {
  117. index: 0,
  118. visible: false,
  119. list: [],
  120. },
  121. refundCauseList: [],
  122. }
  123. },
  124. methods: {
  125. getRefundDetail() {
  126. let self = this;
  127. self.$showLoading();
  128. self.$request({
  129. url: this.$api.order.apply_refund,
  130. data: {
  131. id: self.form.id,
  132. }
  133. }).then(response => {
  134. self.$hideLoading();
  135. self.is_show = true;
  136. if (response.code === 0) {
  137. self.refundDetail = response.data.detail;
  138. self.goodsStatus.list = response.data.list.goods_status;
  139. self.refundList.list = response.data.list.refund_list.confirm_list;
  140. self.refundCauseList = response.data.list.refund_list;
  141. } else {
  142. uni.showModal({
  143. title: '',
  144. content: response.msg,
  145. showCancel: false,
  146. });
  147. }
  148. }).catch(() => {
  149. self.$hideLoading();
  150. });
  151. },
  152. formSubmit() {
  153. let self = this;
  154. if (!self.form.goods_status && self.form.type == 3) {
  155. uni.showModal({
  156. title: '',
  157. content: '请选择货物状态',
  158. showCancel: false,
  159. });
  160. return;
  161. }
  162. if (!self.form.cause) {
  163. let content = self.form.type == 2 ? '请填写换货原因' : '请选择退款原因';
  164. uni.showModal({
  165. title: '',
  166. content: content,
  167. showCancel: false,
  168. });
  169. return;
  170. }
  171. if ((!self.form.refund_price || self.form.refund_price < 0) && self.form.type != 2) {
  172. uni.showModal({
  173. title: '',
  174. content: '请填写退款金额',
  175. showCancel: false,
  176. });
  177. return;
  178. }
  179. if (!self.form.remark) {
  180. uni.showModal({
  181. title: '',
  182. content: '请填写备注信息',
  183. showCancel: false,
  184. });
  185. return;
  186. }
  187. if (!self.form.mobile) {
  188. uni.showModal({
  189. title: '',
  190. content: '请填写联系方式',
  191. showCancel: false,
  192. });
  193. return;
  194. }
  195. this.$subscribe(this.refundDetail.template_message_list).then(response => {
  196. self.submitAction();
  197. }).catch(res => {
  198. self.submitAction();
  199. });
  200. },
  201. submitAction() {
  202. let self = this;
  203. uni.showLoading({
  204. title: '提交中'
  205. });
  206. let refundPrice = self.form.type == 2 ? 0 : self.form.refund_price;
  207. self.$request({
  208. url: self.$api.order.refund_submit,
  209. method: "post",
  210. data: {
  211. id: self.form.id,
  212. type: self.form.type,
  213. pic_list: JSON.stringify(self.form.image_list),
  214. refund_price: refundPrice,
  215. remark: this.form.remark,
  216. mobile: this.form.mobile,
  217. cause: this.form.cause,
  218. goods_status: this.form.goods_status,
  219. },
  220. }).then(response => {
  221. uni.hideLoading();
  222. if (response.code === 0) {
  223. uni.redirectTo({
  224. url: '/pages/order/refund/index'
  225. })
  226. } else {
  227. uni.showModal({
  228. title: '',
  229. content: response.msg,
  230. showCancel: false,
  231. });
  232. }
  233. }).catch(() => {
  234. uni.hideLoading();
  235. });
  236. },
  237. imageEvent(e) {
  238. this.form.image_list = e.imageList;
  239. },
  240. goodsStatusChange(e) {
  241. if (!e.is_modal_confirm) {
  242. this.goodsStatus.index = e.index;
  243. this.form.goods_status = this.goodsStatus.list[this.goodsStatus.index];
  244. if (this.goodsStatus.index == 0) {
  245. this.refundList.list = this.refundCauseList.not_confirm_list;
  246. } else {
  247. this.refundList.list = this.refundCauseList.confirm_list;
  248. }
  249. this.form.cause = '';
  250. }
  251. this.goodsStatus.visible = false;
  252. },
  253. refundListChange(e) {
  254. if (!e.is_modal_confirm) {
  255. this.refundList.index = e.index;
  256. this.form.cause = this.refundList.list[this.refundList.index];
  257. }
  258. this.refundList.visible = false;
  259. },
  260. // 设置页面标题
  261. setPageTitle() {
  262. let title = '订单售后';
  263. if (this.form.type == 1) {
  264. title = '退货退款'
  265. } else if (this.form.type == 2) {
  266. title = '换货';
  267. } else if (this.form.type == 3) {
  268. title = '仅退款';
  269. }
  270. uni.setNavigationBarTitle({
  271. title: title
  272. });
  273. },
  274. },
  275. onLoad(options) {
  276. this.form.id = options.id;
  277. this.form.type = options.type;
  278. this.getRefundDetail();
  279. },
  280. onReady() {
  281. this.setPageTitle();
  282. }
  283. }
  284. </script>
  285. <style lang="scss" scoped="">
  286. .refund-box {
  287. position: absolute;
  288. width: 100%;
  289. height: 100%;
  290. padding: 24#{rpx};
  291. .goods-info {
  292. background: #ffffff;
  293. border-radius: 16#{rpx};
  294. padding: 28#{rpx};
  295. margin-bottom: 24#{rpx};
  296. }
  297. .upload-box {
  298. background: #ffffff;
  299. border-radius: 16#{rpx};
  300. padding:28#{rpx};
  301. display: flex;
  302. flex-direction: column;
  303. margin-top:24#{rpx};
  304. .label {
  305. font-size: 28#{rpx};
  306. color: #353535;
  307. margin-bottom:20#{rpx};
  308. }
  309. }
  310. .content {
  311. margin-top:24#{rpx};
  312. padding:0 28#{rpx};
  313. background: #ffffff;
  314. border-radius: 16#{rpx};
  315. display: flex;
  316. flex-direction: column;
  317. .content-item {
  318. display: flex;
  319. height: 88#{rpx};
  320. align-items: center;
  321. border-bottom:1#{rpx} solid #e2e2e2;
  322. .label {
  323. font-size:28#{rpx};
  324. color: #353535;
  325. width: 152#{rpx};
  326. }
  327. .text {
  328. color: #353535;
  329. font-size:28#{rpx};
  330. flex-grow: 1;
  331. }
  332. .price-text {
  333. color: #ff4544;
  334. }
  335. .price-label {
  336. font-size:28#{rpx};
  337. color: #ff4544;
  338. }
  339. }
  340. .content-item:last-child {
  341. border-bottom: 0;
  342. }
  343. .select-box {
  344. display: flex;
  345. align-items: center;
  346. width: 100%;
  347. .select-label {
  348. font-size:28#{rpx};
  349. width: 100%;
  350. white-space: nowrap;
  351. text-overflow: ellipsis;
  352. overflow: hidden;
  353. display: inline-block;
  354. text-align: right;
  355. }
  356. .no-active {
  357. color: #999999;
  358. }
  359. .active {
  360. color: #353535;
  361. }
  362. .arrow-right {
  363. width: 12#{rpx};
  364. height: 22#{rpx};
  365. margin-left: 16#{rpx};
  366. }
  367. }
  368. }
  369. }
  370. .btn-box {
  371. position: fixed;
  372. bottom: 0;
  373. width: 100%;
  374. padding: 24#{rpx};
  375. background: #f7f7f7;
  376. z-index: 999;
  377. .btn {
  378. border-radius: 40#{rpx};
  379. height: 80#{rpx};
  380. background: #ff4544;
  381. padding: 24#{rpx} 0;
  382. color: #ffffff;
  383. font-size: 32#{rpx};
  384. }
  385. }
  386. </style>