refund.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view class="refundnew">
  3. <view class="van-cell">
  4. <view class="vvan-tit">售后信息</view>
  5. <view class="van-list">
  6. <view class="li" v-for="item in refundDetail.dto" :key="item.id">
  7. <image src="static/images/gou.png" class="gou"></image>
  8. <view>{{ item.remarks }}:{{ item.userName }},最后状态:{{ item.updateNowValue }}</view>
  9. <text>{{ item.createDate }}</text>
  10. </view>
  11. </view>
  12. </view>
  13. <view>
  14. <ul class="ddinfo">
  15. <li>
  16. <span>退款类型:</span>
  17. <view>
  18. <picker v-if="refundDetail.refundState == 30 || refundDetail.refundState == 39" class="picker" :value="psSwyIndex" :range="actions" @change="onSelect" range-key="name">
  19. <view>{{ actions[psSwyIndex].name }}</view>
  20. <image src="static/images/rico.png" class="rico"></image>
  21. </picker>
  22. <view v-else :class="refundDetail.refundState == 30 || refundDetail.refundState == 39 ? 'black' : ''">{{ refundDetail.refundTypeName }}</view>
  23. </view>
  24. </li>
  25. <li v-if="refundDetail.refundType == 2">
  26. <span>退货方式:</span>
  27. <view v-text="refundMethod"></view>
  28. </li>
  29. <li>
  30. <span>退款金额:</span>
  31. <view>¥ {{ refundDetail.refundMoney }}</view>
  32. </li>
  33. <li>
  34. <span>退款原因:</span>
  35. <view>{{ refundDetail.refundReasonName ? refundDetail.refundReasonName : '无理由退款' }}</view>
  36. </li>
  37. <li>
  38. <span>退款说明:</span>
  39. <view>{{ refundDetail.remarks ? refundDetail.remarks : '暂无' }}</view>
  40. </li>
  41. <li @click="refundDetail.imgUrl == '' || refundDetail.imgUrl == null ? (imgShow = false) : (imgShow = true)">
  42. <span>凭证:</span>
  43. <view v-text="refundDetail.imgUrl == '' || refundDetail.imgUrl == null ? '暂无凭证' : '查看'"></view>
  44. </li>
  45. </ul>
  46. <ul class="ddinfo" v-if="refundDetail.refundMethod == 1 && refundDetail.refundState == 36">
  47. <li>
  48. <span>快递公司:</span>
  49. <view v-text="refundDetail.express"></view>
  50. </li>
  51. <li>
  52. <span>快递编号:</span>
  53. <view v-text="refundDetail.expressNo"></view>
  54. </li>
  55. </ul>
  56. <ul class="ddinfo" v-if="refundDetail.refundState != 32 && refundDetail.refundState != 35 && refundDetail.refundState <= 39" style="display: none;">
  57. <li>
  58. <span>审核:</span>
  59. <!-- <template #right-icon>
  60. <van-radio name="1">成功</van-radio>
  61. <van-radio name="0">失败</van-radio>
  62. </template> -->
  63. <view class="dflex radio-rr">
  64. <radio-group @change="radioChange">
  65. <label class="radio">
  66. <radio value="1" />
  67. 成功
  68. </label>
  69. <label class="radio">
  70. <radio value="0" />
  71. 失败
  72. </label>
  73. </radio-group>
  74. </view>
  75. </li>
  76. <li v-if="checkState == 0">
  77. <span class="label">商家留言:</span>
  78. <view class="item flex dflex"><input v-model="refundFalseRes" placeholder="请输入审核失败原因" placeholder-class="placeholder" class="ipt flex" /></view>
  79. </li>
  80. <li v-if="refundDetail.refundState == 32">
  81. <span class="label">商家留言:</span>
  82. <view value="" v-if="refundDetail.refundState == 32">{{ refundDetail.refundFalseRes }}</view>
  83. </li>
  84. </ul>
  85. </view>
  86. <view class="bot">
  87. <view class="sta-btn" @click="back">返回</view>
  88. <!-- <view class="sta-btn red" @click="confirm" v-if="refundDetail.refundState == 30 || refundDetail.refundState == 39">售后审核</view>
  89. <view class="sta-btn" @click="confirm" v-if="refundDetail.refundState == 36">退货确认</view> -->
  90. </view>
  91. <!-- <view class="chufangy" v-if="refundDetail.refundState == 40">请您到后台管理页面进行退款支付操作</view> -->
  92. </view>
  93. </template>
  94. <script>
  95. const req = require('../utils/request');
  96. const utils = require("../utils/util");
  97. export default {
  98. data() {
  99. return {
  100. refundReason: {},
  101. refundFalseRes: '',
  102. refundType: '',
  103. refundMethod: '',
  104. action: false,
  105. psSwyIndex: 0,
  106. actions: [
  107. {
  108. name: '只退款'
  109. },
  110. {
  111. name: '退货并退款'
  112. }
  113. ],
  114. refundTypenum: 1,//默认1只退款
  115. refundDetail: {},
  116. imgUrl: [],
  117. imgIndex: 0,
  118. imgShow: false,
  119. show: false,
  120. orderId: '',
  121. active: 0,
  122. radio: 2,
  123. checkState: -1
  124. };
  125. },
  126. onLoad(opt) {
  127. this.orderId = opt.id;
  128. console.log('id》》》》》》');
  129. this.refundDataShow();
  130. },
  131. methods: {
  132. // 退款类型切换
  133. onSelect(e) {
  134. this.psSwyIndex = e.target.value;
  135. var name = this.actions[this.psSwyIndex].name;
  136. if (name == '只退款') {
  137. this.refundTypenum = 1;
  138. } else if (name == '退货并退款') {
  139. this.refundTypenum = 2;
  140. }
  141. this.refundDetail.refundTypeName = name;
  142. console.log(this.refundTypenum);
  143. },
  144. // 图片切换下标
  145. imgonChange(index) {
  146. this.imgIndex = index;
  147. },
  148. // 售后信息详情
  149. refundDataShow() {
  150. req.getRequest(
  151. '/api/orderRefund/refundDataShow',
  152. {
  153. orderId: this.orderId
  154. },
  155. res => {
  156. if (res.refundMethod == 1) {
  157. this.refundMethod = '邮寄';
  158. } else if (res.refundMethod == 2) {
  159. this.refundMethod = '送回门店';
  160. } else if (res.refundMethod == 3) {
  161. this.refundMethod = '货物拒收';
  162. }
  163. // res.dto.forEach(it => {
  164. // const pattern = /[`~!@#$^&*()=|{}':;',\\\[\]\.<>\/?~!@#¥……&*()——|{}【】';:""' + - - _ % 。,、?\s]/g;
  165. // it.userName = it.userName.replace(pattern, '');
  166. // });
  167. this.refundDetail = res;
  168. if (res.imgUrl) {
  169. this.imgUrl = res.imgUrl.split(',');
  170. }
  171. console.log(res.dto.length);
  172. this.active = res.dto.length - 1;
  173. },
  174. true
  175. );
  176. },
  177. // 二次确认框
  178. confirm() {
  179. console.log(this.checkState);
  180. if (this.checkState == -1) {
  181. req.msg('请您选择审核成功或审核失败');
  182. } else {
  183. this.showDialog();
  184. }
  185. },
  186. showDialog() {
  187. var tha=this;
  188. var msg = '';
  189. if (this.refundDetail.refundState == 40 && this.checkState == 1) {
  190. msg = '是否确认退款?';
  191. } else if (this.refundDetail.refundState == 40 && this.checkState == 0) {
  192. msg = '您确定拒绝退款?';
  193. } else if (this.checkState == 0 && (this.refundDetail.refundState == 39 || this.refundDetail.refundState == 30)) {
  194. msg = '您确认要拒绝客户的售后审核吗?';
  195. } else if (this.checkState == 1 && this.refundDetail.refundState != 40) {
  196. msg = '请确认是否发货,发货后的售后就让客户先退货?';
  197. } else if (this.refundDetail.refundState == 36 && this.checkState == 0) {
  198. msg = '您确认客户退回的商品不能入库,您要结束本次售后服务?';
  199. }
  200. uni.showModal({
  201. title: '提示',
  202. content: msg,
  203. success(res) {
  204. if (res.confirm) {
  205. // 售后申请
  206. if (tha.refundDetail.refundState == 39 || tha.refundDetail.refundState == 30) {
  207. console.log('您确认要拒绝客户的售后审核吗?');
  208. tha.applyRefund();
  209. }
  210. // 退款支付
  211. if (tha.refundDetail.refundState == 40) {
  212. req.msg('请您到后台管理页面进行最后一步退款操作');
  213. }
  214. // 退货中
  215. if (tha.refundDetail.refundState == 36) {
  216. tha.goodRefund();
  217. }
  218. } else if (res.cancel) {
  219. }
  220. }
  221. });
  222. },
  223. back() {
  224. uni.navigateBack(); // 返回上一层
  225. },
  226. radioChange: function(evt) {
  227. this.checkState = evt.detail.value;
  228. },
  229. applyRefund() {
  230. if (this.checkState == 1) {
  231. this.refundFalseRes = '';
  232. }
  233. if (this.checkState == '') {
  234. req.msg('请您选择审核成功或审核失败');
  235. }
  236. let dto = {
  237. id: this.refundDetail.id,
  238. orderId: this.orderId,
  239. checkState: this.checkState,
  240. refundType: this.refundTypenum
  241. };
  242. if (this.checkState == 0) {
  243. dto.refundFalseRes = this.refundFalseRes;
  244. }
  245. //+ JSON.stringify(dto)
  246. req.putRequestJson('/api/orderRefund/apply?'+utils.convertUrlObj(dto), dto, res => {
  247. req.msg('操作成功');
  248. this.refundDataShow();
  249. console.log(res);
  250. });
  251. },
  252. goodRefund() {
  253. if (this.checkState == 1) {
  254. this.refundFalseRes = '';
  255. }
  256. let dto = {
  257. id: this.refundDetail.id,
  258. orderId: this.orderId,
  259. checkState: this.checkState,
  260. refundType: this.refundTypenum
  261. };
  262. if (dto.checkState == '') {
  263. req.msg('请您选择审核成功或审核失败');
  264. }
  265. if (this.checkState == 0) {
  266. dto.refundFalseRes = this.refundFalseRes;
  267. }
  268. //+ JSON.stringify(dto)
  269. req.putRequestJson('/api/orderRefund/goodRefund?'+utils.convertUrlObj(dto), dto, res => {
  270. req.msg('操作成功');
  271. this.refundDataShow();
  272. console.log(res);
  273. });
  274. }
  275. }
  276. };
  277. </script>
  278. <style scoped>
  279. @import './static/css/main.css';
  280. .view:not(:last-child) {
  281. margin-right: 10px;
  282. }
  283. .van-radio:not(:last-child) {
  284. margin-right: 10px;
  285. }
  286. .refundnew {
  287. padding: 0 0 70px 0;
  288. }
  289. .black {
  290. color: #000000;
  291. }
  292. .chufangy {
  293. position: fixed;
  294. background: rgba(247, 3, 3, 0.6);
  295. left: 0;
  296. right: 0;
  297. bottom: 50px;
  298. height: 30px;
  299. line-height: 30px;
  300. font-size: 12px;
  301. color: #fff;
  302. text-align: center;
  303. z-index: 50;
  304. }
  305. .ddinfo {
  306. margin: 0;
  307. border-radius: 0;
  308. }
  309. .ddinfo li:last-child {
  310. border-bottom: 1px solid #eeeeee;
  311. }
  312. .sta-btn {
  313. padding: 0 6px;
  314. border-color: #fe0419;
  315. /* background: #FE0419; */
  316. border-radius: 12px;
  317. text-align: center;
  318. line-height: 25px;
  319. font-size: 11px;
  320. color: #fe0419;
  321. margin-left: 5px;
  322. }
  323. .sta-btn.red {
  324. color: #fff;
  325. background: #fe0419;
  326. }
  327. </style>