applicationDrawback.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <template>
  2. <view class="container">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <view class="bg-fff u-mt20 u-p30" v-if="keystatus == 1">
  5. <view class="goodsItem u-flex-center mb20" v-for="(value, index) in list" :key="value.id">
  6. <image :src="value.goods_cover" v-if="value.goods_cover" class="u-goods200 u-ml15" mode=""></image>
  7. <image :src="value.goods_img" v-if="value.goods_img" class="u-goods200 u-ml15" mode=""></image>
  8. <view class="u-flex1 u-flex-column-start rightText u-ml30">
  9. <view class="u-text2 u-1A1A1A u-font28">{{ value.goods_title }}</view>
  10. <view class="bottext u-flex-column-start u-flex1">
  11. <text class="u-font22 u-999" v-if="value.sku_set_name">规格: {{ value.sku_set_name }}</text>
  12. <view class="u-flex-center botPrice">
  13. <view class="u-FF0000 u-font32 " v-if="value.exchange">{{ value.exchange_point }} 积分</view>
  14. <view class="u-FF0000 u-font32 " v-else>
  15. <rich-text :nodes="$mUtil.priceBigSmall(value.sale_price)"></rich-text>
  16. </view>
  17. <text class="u-font26 u-666 u-ml15" v-if="value.num">x {{ value.num }}</text>
  18. <text class="u-font26 u-666 u-ml15" v-if="value.number">x {{ value.number }}</text>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="bg-fff u-mt20 u-p30" v-if="keystatus == 2 || keystatus == 3">
  25. <view class="goodsItem u-flex-center">
  26. <image :src="value.goods_cover" v-if="value.goods_cover" class="u-goods200 u-ml15" mode=""></image>
  27. <image :src="value.goods_img" v-if="value.goods_img" class="u-goods200 u-ml15" mode=""></image>
  28. <view class="u-flex1 u-flex-column-start rightText u-ml30">
  29. <view class="u-text2 u-1A1A1A u-font28">{{ value.goods_title }}</view>
  30. <view class="bottext u-flex-column-start u-flex1">
  31. <text class="u-font22 u-999" v-if="value.sku_set_name">规格: {{ value.sku_set_name }}</text>
  32. <view class="u-flex-center botPrice">
  33. <view class="u-FF0000 u-font32 " v-if="value.exchange">{{ value.exchange_point }} 积分</view>
  34. <view class="u-FF0000 u-font32 " v-else>
  35. <rich-text :nodes="$mUtil.priceBigSmall(value.sale_price)"></rich-text>
  36. </view>
  37. <text class="u-font26 u-666 u-ml15" v-if="value.num">x {{ value.num }}</text>
  38. <text class="u-font26 u-666 u-ml15" v-if="value.number">x {{ value.number }}</text>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="u-bg-fff u-mt20">
  45. <view class="u-plr30">
  46. <picker @change="pickerChange($event, 'industry')" :value="applicationTypeIndex" range-key="name"
  47. :range="applicationTypeList" v-if="applicationTypeList.length > 0">
  48. <view class="u-flex-center-sb u-border-one-one ht104">
  49. <view class="u-1A1A1A">售后类型</view>
  50. <view class="u-flex">
  51. <view class="uni-input ml38 u-4D4D4D">{{ applicationTypeList[applicationTypeIndex].name }}</view>
  52. <view class="iconfont u-666">&#xe6c7;</view>
  53. </view>
  54. </view>
  55. </picker>
  56. <picker @change="pickerChangeres($event, 'industry')" :value="applicationIndex" range-key="name"
  57. :range="applicationList" v-if="applicationList.length > 0">
  58. <view class="u-flex-center-sb u-border-one-one ht104">
  59. <view class="u-1A1A1A">售后原因</view>
  60. <view class="u-flex">
  61. <view class="uni-input ml38 u-4D4D4D">{{ applicationList[applicationIndex].name }}</view>
  62. <view class="iconfont u-666">&#xe6c7;</view>
  63. </view>
  64. </view>
  65. </picker>
  66. <view class="u-flex-center-sb u-border-one-one ht104" v-if="keystatus == 2">
  67. <view class="u-1A1A1A">数量</view>
  68. <view class="rightAddRes u-flex-center">
  69. <text class=" btnTag" @click="resNum">-</text>
  70. <text class="u-flex1 centertext u-font28 u-999">{{ num }}</text>
  71. <text class="btnTag" @click="addNum">+</text>
  72. </view>
  73. </view>
  74. <view class="u-flex-center-sb u-border-one-one ht104">
  75. <view class="u-1A1A1A">退款金额</view>
  76. <!-- <view class="u-FF0000 u-font32 u-bold"><rich-text :nodes="$mUtil.priceBigSmall(12.2)" ></rich-text></view> -->
  77. <input type="digit" :value="money" maxlength="10" @input="onchangeInput"
  78. class="u-FF0000 u-font32 u-flex1 u-text-right" />
  79. </view>
  80. <view class="u-flex-center-sb u-border-one-one ht104" v-if="able_refund_point > 0">
  81. <view class="u-1A1A1A">退款积分</view>
  82. <view class="u-FF0000 u-font32 ">{{ able_refund_point }}</view>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="u-bg-fff u-plr30 apply">
  87. <view class="u-060606">退款备注</view>
  88. <view class="u-mt25"><textarea placeholder="请您详细填写申请说明" @input="onchangeText" maxlength="45"></textarea></view>
  89. <view class="u-mt30 u-060606">上传凭证</view>
  90. <view class="u-mt25">
  91. <uploadImg imgCount="3" url="" :type="upimgtype" @result="resultUrl" @delImg="delImg"></uploadImg>
  92. </view>
  93. </view>
  94. <view class="btn" @click="submitApply"><button class="u-btn-two">提交审核</button></view>
  95. </view>
  96. </template>
  97. <script>
  98. import uploadImg from '../../../components/uploadImg/imgUpload.vue';
  99. import uniPopup from '../../../components/uni-popup/uni-popup.vue';
  100. export default {
  101. components: {
  102. uploadImg,
  103. uniPopup
  104. },
  105. data() {
  106. return {
  107. upimgtype: 'rights',
  108. config: {
  109. back: true, //false是tolbar页面 是则不写
  110. title: '申请退款',
  111. color: '#1a1a1a',
  112. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  113. backgroundColor: [1, '#fff'],
  114. statusBarFontColor: '#1A1A1A'
  115. },
  116. applicationTypeIndex: 0,
  117. applicationIndex: 0,
  118. applicationTypeList: [], //申请类型
  119. applicationList: [{
  120. code: 1,
  121. name: '多拍、错拍、不想要'
  122. }, {
  123. code: 1,
  124. name: '不喜欢、效果不好'
  125. }, {
  126. code: 1,
  127. name: '商品成分描述不符'
  128. }, {
  129. code: 1,
  130. name: '其他'
  131. }], //申请类型
  132. imgArray: [], //图片列表
  133. value: {},
  134. keystatus: 1, //1未发货,退款,2收到货退款/退货
  135. parent_order_id: null,
  136. order_id: null,
  137. list: [],
  138. money: 0,
  139. moneyold: 0,
  140. num: 0,
  141. number: 0,
  142. flag: true,
  143. reason: '',
  144. caption: '',
  145. able_refund_point: 0,
  146. type: null,
  147. third: false,
  148. verifyList: [],
  149. third_service_type: 0,
  150. third_reasons_type_code: 0,
  151. third_package_type_code: 0,
  152. };
  153. },
  154. onLoad(option) {
  155. let goodslist = uni.getStorageSync('blackgoodsList');
  156. if (option.title) {
  157. this.config.title = option.title;
  158. }
  159. if (option.id) {
  160. this.order_id = option.id;
  161. }
  162. if (option.orderid) {
  163. this.parent_order_id = option.orderid;
  164. }
  165. if (option.type) {
  166. this.type = option.type;
  167. }
  168. if (option.third == 'true') {
  169. this.third = option.third == 'true' ? true : false
  170. this.verify()
  171. }
  172. if (option.keystatus) {
  173. this.keystatus = option.keystatus;
  174. if (option.keystatus == 2 || option.keystatus == 3) {
  175. //子订单
  176. if (goodslist) {
  177. goodslist.forEach(item => {
  178. if (item.id == option.id) {
  179. this.value = item;
  180. this.childOrder(option.orderid, option.id, item.number);
  181. this.addNumber(option.orderid, option.id, item.number);
  182. }
  183. });
  184. }
  185. if (option.keystatus == 2) {
  186. this.applicationTypeList = [{
  187. i: 0,
  188. name: '退款'
  189. }, {
  190. i: 1,
  191. name: '退货'
  192. }];
  193. this.reason = this.applicationList[this.applicationIndex].name;
  194. }
  195. } else {
  196. //主订单
  197. if (goodslist) {
  198. this.list = goodslist;
  199. }
  200. this.mainOrder(option.orderid);
  201. this.applicationTypeList = [{
  202. i: 0,
  203. name: '退款'
  204. }];
  205. this.reason = this.applicationList[this.applicationIndex].name;
  206. }
  207. }
  208. },
  209. methods: {
  210. onchangeText(e) {
  211. if (e) {
  212. this.caption = e.detail.value;
  213. }
  214. e;
  215. },
  216. onchangeInput(e) {
  217. if (e) {
  218. this.money = e.detail.value;
  219. }
  220. },
  221. resultUrl(e) {
  222. this.imgArray = e;
  223. },
  224. delImg(e) {
  225. this.imgArray = e;
  226. },
  227. submitApply() {
  228. let that = this;
  229. if (!that.caption) {
  230. that.$mUtil.toast('请填写退款备注');
  231. return false;
  232. }
  233. if (this.imgArray.length == 0) {
  234. this.$mUtil.toast('请填上传凭证')
  235. return false
  236. }
  237. if (that.money * 1 > that.moneyold * 1) {
  238. that.$mUtil.toast('退款金额不能大于' + that.moneyold);
  239. return false;
  240. }
  241. if (that.keystatus == 1) {
  242. let data = {
  243. order_id: that.parent_order_id,
  244. rights_cargo_status: 0, //0未收货,1已收货
  245. rights_type: 1, //1仅退款,2退款退货
  246. reason: that.reason,
  247. caption: that.caption,
  248. voucher_images: that.imgArray,
  249. refund_money: that.money,
  250. refund_point: that.able_refund_point
  251. };
  252. that.$http.post('/rights/apply/order', data).then(res => {
  253. if (res && res.code == 200) {
  254. that.$mUtil.toast('申请成功');
  255. setTimeout(() => {
  256. // uni.reLaunch({
  257. // url: '/pages/order/orderList/orderList?keys=6'
  258. // });
  259. uni.navigateBack()
  260. }, 1000);
  261. }
  262. });
  263. } else {
  264. let data = {
  265. order_id: that.parent_order_id,
  266. child_order_id: that.order_id,
  267. rights_cargo_status: 1, //0未收货,1已收货
  268. rights_type: that.applicationTypeIndex * 1 + 1, //1仅退款,2退款退货
  269. reason: that.reason,
  270. caption: that.caption,
  271. voucher_images: that.imgArray,
  272. refund_money: that.money,
  273. refund_num: that.num,
  274. refund_point: that.able_refund_point
  275. };
  276. if (that.third) {
  277. data.third_service_type = this.third_service_type
  278. if (data.third_service_type == '40') {
  279. data.rights_type = 1
  280. } else if (data.third_service_type == '50') {
  281. data.rights_type = 2
  282. }
  283. data.third_reasons_type_code = this.third_reasons_type_code
  284. data.third_package_type_code = 0
  285. } else {
  286. data.third_service_type = 0
  287. data.third_reasons_type_code = 0
  288. data.third_package_type_code = 0
  289. }
  290. that.$http.post('/rights/apply/child', data).then(res => {
  291. if (res && res.code == 200) {
  292. that.$mUtil.toast('申请成功');
  293. setTimeout(() => {
  294. // uni.reLaunch({
  295. // url: '/pages/order/orderList/orderList'
  296. // });
  297. uni.navigateBack()
  298. }, 1000);
  299. }
  300. });
  301. }
  302. },
  303. //减
  304. resNum() {
  305. if (this.num * 1 > 1) {
  306. this.flag = false;
  307. this.num--;
  308. this.addNumber(this.parent_order_id, this.order_id, this.num);
  309. }
  310. },
  311. //加
  312. addNum() {
  313. console.log(this.number);
  314. if (this.num < this.number) {
  315. this.flag = false;
  316. this.num++;
  317. this.addNumber(this.parent_order_id, this.order_id, this.num);
  318. }
  319. },
  320. //主订单可以最多可以退多少钱
  321. mainOrder(id) {
  322. let data = {
  323. order_id: id
  324. };
  325. this.$http.post('/rights/main/able-refund-money', data).then(res => {
  326. if (res && res.code == 200) {
  327. this.money = res.data.able_refund_money;
  328. this.moneyold = res.data.able_refund_money;
  329. this.able_refund_point = res.data.able_refund_point;
  330. // this.num = res.data.goods_num
  331. // this.number = res.data.goods_num
  332. }
  333. });
  334. },
  335. //子订单可以最多可以退多少钱
  336. childOrder(id, childid, num) {
  337. let data = {
  338. order_id: id,
  339. child_order_id: childid,
  340. refund_num: num
  341. };
  342. this.$http.post('/rights/child/able-refund-money', data).then(res => {
  343. if (res && res.code == 200) {
  344. this.money = res.data.able_refund_money;
  345. this.moneyold = res.data.able_refund_money;
  346. this.able_refund_point = res.data.able_refund_point;
  347. this.number = res.data.goods_num;
  348. if (this.flag) {
  349. this.num = res.data.goods_num;
  350. }
  351. }
  352. });
  353. },
  354. addNumber(id, childid, num) {
  355. let data = {
  356. order_id: id,
  357. child_order_id: childid,
  358. refund_num: num
  359. };
  360. this.$http.post('/rights/child/able-refund-money', data).then(res => {
  361. if (res && res.code == 200) {
  362. this.money = res.data.able_refund_money;
  363. this.moneyold = res.data.able_refund_money;
  364. this.able_refund_point = res.data.able_refund_point;
  365. if (this.flag) {
  366. this.num = res.data.goods_num;
  367. }
  368. }
  369. });
  370. },
  371. pickerChange(e, val) {
  372. this.applicationTypeIndex = e.target.value;
  373. if (this.third) {
  374. this.third_service_type = this.applicationTypeList[e.target.value].code
  375. }
  376. },
  377. pickerChangeres(e, val) {
  378. this.applicationIndex = e.target.value;
  379. this.reason = this.applicationList[e.target.value].name;
  380. if (this.third) {
  381. this.third_reasons_type_code = this.applicationList[e.target.value].code
  382. }
  383. },
  384. // 第三方售后前置校验
  385. verify() {
  386. this.$http.post('/rights/third/beforeCheck', {
  387. order_id: this.parent_order_id,
  388. child_order_id: this.order_id
  389. }).then(res => {
  390. if (res.code == 200 && res.data) {
  391. if (res.data.serviceType.length > 0) {
  392. this.verifyList = res.data.serviceType
  393. this.applicationTypeList = []
  394. this.applicationList = []
  395. this.applicationList = res.data.reasonsType
  396. for (let item of res.data.serviceType) {
  397. if (item.code == '40' || item.code == '50') {
  398. this.applicationTypeList.push(item);
  399. }
  400. }
  401. this.third_service_type = this.applicationTypeList[0].code
  402. this.third_reasons_type_code = this.applicationList[0].code
  403. this.reason = this.applicationList[0].name;
  404. }
  405. }
  406. }).catch(err => {})
  407. }
  408. }
  409. };
  410. </script>
  411. <style lang="scss">
  412. page {
  413. background-color: #fafafa;
  414. }
  415. .bg-fff {
  416. background-color: #fff;
  417. }
  418. .ml38 {
  419. margin-left: 38rpx;
  420. }
  421. .mb20 {
  422. margin-bottom: 20rpx;
  423. }
  424. .ht104 {
  425. height: 104rpx;
  426. line-height: 104rpx;
  427. }
  428. .rightAddRes {
  429. width: 172rpx;
  430. height: 50rpx;
  431. border-radius: 8rpx;
  432. border: 1px solid #e5e5e5;
  433. .centertext {
  434. text-align: center;
  435. }
  436. .btnTag {
  437. width: 50rpx;
  438. height: 50rpx;
  439. line-height: 50rpx;
  440. text-align: center;
  441. background-color: #dedede;
  442. font-size: 46rpx;
  443. color: #888;
  444. }
  445. }
  446. .p-tlbr30 {
  447. padding: 30rpx;
  448. }
  449. textarea {
  450. width: 100%;
  451. height: 210rpx;
  452. opacity: 0.66;
  453. border: 1rpx solid #e6e6e6;
  454. border-radius: 8rpx;
  455. padding-left: 22rpx;
  456. padding-top: 14rpx;
  457. box-sizing: border-box;
  458. }
  459. .apply {
  460. padding-top: 34rpx;
  461. padding-bottom: 42rpx;
  462. }
  463. .btn {
  464. padding: 70rpx 30rpx;
  465. button {
  466. background: #FA6138;
  467. color: #ffffff;
  468. }
  469. }
  470. </style>