afterSalesDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <view class="content">
  3. <u-form :model="form" ref="uForm">
  4. <view class="after-sales-goods-detail-view">
  5. <view class="header">
  6. <view>
  7. 本次售后服务将由
  8. <text class="seller-name">{{ sku.storeName }}</text>
  9. 为您提供
  10. </view>
  11. </view>
  12. <view>
  13. <view class="goods-item-view" v-for="(item,index) in sku.orderItems" v-if="item.sn == sn" @click="gotoGoodsDetail(sku.goods_id)">
  14. <view class="goods-img">
  15. <u-image border-radius="6" width="131rpx" height="131rpx" :src="item.image"></u-image>
  16. </view>
  17. <view class="goods-info">
  18. <view class="goods-title u-line-2">{{ item.name }}</view>
  19. <view class="goods-price">
  20. <span>¥{{ applyInfo.applyRefundPrice }}</span>
  21. <span class="num">购买数量:{{ item.num }}</span>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="after-num">
  27. <view>申请数量</view>
  28. <view>
  29. <u-number-box :value="parseInt(form.num)" disabled-input :min="1" :max="parseInt(sku.num)" bg-color="#fff" @change="valChange"></u-number-box>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="body-view">
  34. <!-- 退款原因 -->
  35. <view class="opt-view">
  36. <u-form-item label="申请原因" :label-width="150">
  37. <u-input v-model="form.reason" type="select" input-align="right" :select-open="reasonSelectShow" @click="reasonSelectShow = true" placeholder="请选择申请原因" />
  38. </u-form-item>
  39. <u-form-item label="申请说明" :label-width="150">
  40. <u-input input-align="right" type="textarea" v-model="form.problemDesc" placeholder="请描述申请售后的说明" />
  41. </u-form-item>
  42. </view>
  43. <!-- 上传凭证 -->
  44. <view class="opt-view">
  45. <view class="img-title">上传凭证(最多5张)</view>
  46. <view class="images-view">
  47. <u-upload :header=" { accessToken: storage.getAccessToken() }" :action="action" width="150" @on-uploaded="onUploaded" :max-count="5" :show-progress="false"></u-upload>
  48. </view>
  49. </view>
  50. <view class="opt-view">
  51. <u-form-item label="退款方式" :label-width="150">
  52. <u-input :value="
  53. applyInfo.refundWay == 'ORIGINAL' ? '原路退回' : '账号退款'
  54. " type="text" input-align="right" :disabled="true" />
  55. </u-form-item>
  56. <view >
  57. <u-form-item label="银行开户行" :label-width="150">
  58. <u-input v-model="form.bankDepositName" type="text" input-align="right" placeholder="请输入银行开户行" />
  59. </u-form-item>
  60. <u-form-item label="银行开户名" :label-width="150">
  61. <u-input v-model="form.bankAccountName" type="text" input-align="right" placeholder="请输入银行开户名" />
  62. </u-form-item>
  63. <u-form-item label="银行账号" :label-width="150">
  64. <u-input v-model="form.bankAccountNumber" type="text" input-align="right" placeholder="请输入银行账号" />
  65. </u-form-item>
  66. </view>
  67. <u-form-item label="返回方式" :label-width="150">
  68. <u-input type="text" input-align="right" value="快递至第三方卖家" :disabled="true" />
  69. </u-form-item>
  70. </view>
  71. <view class="opt-tip">提交服务单后,售后专员可能与您电话沟通,请保持手机畅通</view>
  72. </view>
  73. </u-form>
  74. <view class="submit-view">
  75. <u-button type="primary" ripple shape="circle" v-if="applyInfo.refundWay" :custom-style="customStyle" @click="onSubmit">提交申请</u-button>
  76. </view>
  77. <u-select mode="single-column" :list="reasonList" v-model="reasonSelectShow" @confirm="reasonSelectConfirm"></u-select>
  78. <u-select mode="single-column" :list="typeList" v-model="typeSelectShow" @confirm="typeSelectConfirm"></u-select>
  79. <u-select mode="single-column" :list="returnList" v-model="returnSelectShow" @confirm="returnSelectConfirm"></u-select>
  80. <u-toast ref="uToast" />
  81. </view>
  82. </template>
  83. <script>
  84. import {
  85. getAfterSaleReason,
  86. applyReturn,
  87. getAfterSaleInfo,
  88. } from "@/api/after-sale";
  89. import city from "@/components/m-city/m-city";
  90. import { upload } from "@/api/common.js";
  91. import {checkBankno} from '@/utils/Foundation'
  92. import storage from "@/utils/storage.js";
  93. export default {
  94. component: {
  95. city,
  96. },
  97. data() {
  98. return {
  99. storage,
  100. list: [{ id: "", localName: "请选择", children: [] }],
  101. action: upload, //图片上传数据
  102. fileList: [],
  103. sn: "",
  104. sku: {},
  105. typeValue: 0,
  106. value: "",
  107. type: "textarea",
  108. border: true,
  109. //退款原因 弹出框
  110. reasonSelectShow: false,
  111. reasonList: [],
  112. //退款方式为账号退款 账号类型弹出框
  113. typeSelectShow: false,
  114. typeList: [
  115. {
  116. value: "ALIPAY",
  117. label: "支付宝",
  118. },
  119. {
  120. value: "WEIXINPAY",
  121. label: "微信",
  122. },
  123. {
  124. value: "BANK_TRANSFER",
  125. label: "银行卡",
  126. },
  127. ],
  128. //返回方式
  129. returnSelectShow: false,
  130. returnList: [
  131. {
  132. value: 1,
  133. label: "快递至第三方卖家",
  134. },
  135. ],
  136. customStyle: {
  137. backgroundColor: this.$lightColor,
  138. },
  139. applyInfo: {},
  140. form: {
  141. orderItemSn: "", // 订单sn
  142. skuId: "",
  143. reason: "", //退款原因
  144. problemDesc: "", //退款说明
  145. images: [], //图片凭证
  146. num: 1, //退货数量
  147. goodsId: "", //商品id
  148. accountType: "",
  149. applyRefundPrice: "",
  150. refundWay: "",
  151. serviceType: "", //申请类型
  152. },
  153. };
  154. },
  155. /**
  156. * 判断当前内容并生成数据
  157. */
  158. onLoad(options) {
  159. let navTitle = "申请售后";
  160. this.form.serviceType = "RETURN_GOODS";
  161. if (options.value == 1) {
  162. navTitle = "申请退货";
  163. this.form.serviceType = "RETURN_GOODS";
  164. }
  165. if (options.value == 2) {
  166. navTitle = "申请换货";
  167. this.form.serviceType = "EXCHANGE_GOODS";
  168. }
  169. if (options.value == 3) {
  170. navTitle = "申请退款";
  171. this.form.serviceType = "RETURN_MONEY";
  172. }
  173. this.typeValue = options.value;
  174. uni.setNavigationBarTitle({
  175. title: navTitle, //此处写页面的title
  176. });
  177. this.sn = options.sn;
  178. let dsku = decodeURIComponent(options.sku);
  179. let newSku = JSON.parse(dsku);
  180. this.sku = newSku
  181. this.form.orderItemSn = options.sn;
  182. this.form.skuId = this.sku.skuId;
  183. this.form.num = this.sku.num;
  184. this.form.goodsId = this.sku.goodsId;
  185. this.getReasonActions(this.form.serviceType);
  186. this.init(options.sn);
  187. },
  188. methods: {
  189. /** 获取申请原因下拉框数据 */
  190. async getReasonActions(serviceType) {
  191. uni.showLoading({
  192. title: "加载中",
  193. });
  194. await getAfterSaleReason(serviceType).then((res) => {
  195. if (res.data.success) {
  196. let action = [];
  197. res.data.result.forEach((item) => {
  198. action.push({
  199. value: item.id,
  200. label: item.reason,
  201. });
  202. });
  203. this.reasonList = action;
  204. }
  205. });
  206. uni.hideLoading();
  207. },
  208. //打开地区选择器
  209. showCitySelect() {
  210. this.$refs.cityPicker.show();
  211. },
  212. // 初始化数据
  213. init(sn) {
  214. getAfterSaleInfo(sn).then((response) => {
  215. if (response.data.code == 400) {
  216. uni.showToast({
  217. title: response.data.message,
  218. duration: 2000,
  219. icon: "none",
  220. });
  221. } else {
  222. this.applyInfo = response.data.result;
  223. this.form.accountType = response.data.result.accountType;
  224. }
  225. });
  226. },
  227. //退款原因
  228. reasonSelectConfirm(e) {
  229. this.form.reason = e[0].label;
  230. },
  231. //退款方式
  232. typeSelectConfirm(e) {
  233. this.form.accountType = e[0].value;
  234. this.form.accountType_label = e[0].label;
  235. },
  236. //返回方式
  237. returnSelectConfirm(e) {
  238. },
  239. //修改申请数量
  240. valChange(e) {
  241. this.form.num = e.value;
  242. },
  243. //图片上传
  244. onUploaded(lists) {
  245. let images = [];
  246. lists.forEach((item) => {
  247. images.push(item.response.result);
  248. });
  249. this.form.images = images;
  250. },
  251. //提交申请
  252. onSubmit() {
  253. //提交申请前检测参数
  254. if (!this.handleCheckParams()) {
  255. return;
  256. }
  257. uni.showLoading({
  258. title: "加载中",
  259. });
  260. this.form.accountType = this.applyInfo.accountType;
  261. this.form.refundWay = this.applyInfo.refundWay;
  262. this.form.applyRefundPrice = this.applyInfo.applyRefundPrice;
  263. applyReturn(this.sn, this.form).then((resp) => {
  264. uni.hideLoading();
  265. if (resp.data.success) {
  266. this.$refs.uToast.show({ title: "提交成功", type: "success" });
  267. uni.redirectTo({
  268. url: "/pages/order/afterSales/applySuccess",
  269. });
  270. } else {
  271. this.$refs.uToast.show({ title: resp.data.message, type: "error" });
  272. }
  273. });
  274. },
  275. //检测提交参数
  276. handleCheckParams() {
  277. if (this.$u.test.isEmpty(this.form.reason)) {
  278. this.$refs.uToast.show({ title: "请选择 退款原因", type: "error" });
  279. return false;
  280. }
  281. if (this.$u.test.isEmpty(this.form.problemDesc)) {
  282. this.$refs.uToast.show({ title: "请输入 退款说明", type: "error" });
  283. return false;
  284. }
  285. if (this.form.accountType == "BANK_TRANSFER") {
  286. // 银行开户行校验
  287. if (this.$u.test.isEmpty(this.form.bankDepositName)) {
  288. this.$refs.uToast.show({
  289. title: "请输入 银行开户行",
  290. type: "error",
  291. });
  292. return false;
  293. }
  294. // 银行开户名校验
  295. if (this.$u.test.isEmpty(this.form.bankAccountName)) {
  296. this.$refs.uToast.show({
  297. title: "请输入 银行开户名",
  298. type: "error",
  299. });
  300. return false;
  301. }
  302. // 银行账号校验
  303. if (this.$u.test.isEmpty(this.form.bankAccountNumber)) {
  304. this.$refs.uToast.show({
  305. title: "请输入 银行账号",
  306. type: "error",
  307. });
  308. return false;
  309. } else if (checkBankno(this.form.bankAccountNumber) === false) {
  310. this.$refs.uToast.show({
  311. title: "银行卡卡号不正确",
  312. type: "error",
  313. });
  314. return false;
  315. } else if (this.$u.test.chinese(this.form.bankAccountName) === false) {
  316. this.$refs.uToast.show({
  317. title: "银行开户名输入错误",
  318. type: "error",
  319. });
  320. return false;
  321. } else if (this.$u.test.chinese(this.form.bankDepositName) === false) {
  322. this.$refs.uToast.show({
  323. title: "银行开户行输入错误",
  324. type: "error",
  325. });
  326. return false;
  327. }
  328. }
  329. return true;
  330. },
  331. },
  332. };
  333. </script>
  334. <style lang="scss" scoped>
  335. page,
  336. .content {
  337. background: $page-color-base;
  338. height: 100%;
  339. }
  340. .body-view {
  341. margin-bottom: 150rpx;
  342. }
  343. .after-sales-goods-detail-view {
  344. background-color: #fff;
  345. .header {
  346. background-color: #f7f7f7;
  347. color: #999999;
  348. font-size: 22rpx;
  349. display: flex;
  350. flex-direction: row;
  351. align-items: center;
  352. justify-content: center;
  353. line-height: 70rpx;
  354. .header-text {
  355. background-color: #999999;
  356. padding: 10rpx 30rpx;
  357. border-radius: 50rpx;
  358. }
  359. .seller-name {
  360. color: $main-color;
  361. }
  362. }
  363. .goods-item-view {
  364. display: flex;
  365. flex-direction: row;
  366. padding: 10rpx 30rpx;
  367. background-color: #eef1f2;
  368. .goods-info {
  369. padding-left: 30rpx;
  370. flex: 1;
  371. .goods-title {
  372. margin-bottom: 10rpx;
  373. color: $font-color-dark;
  374. }
  375. .goods-specs {
  376. font-size: 24rpx;
  377. margin-bottom: 10rpx;
  378. color: #cccccc;
  379. }
  380. .goods-price {
  381. display: flex;
  382. flex-direction: row;
  383. justify-content: space-between;
  384. font-size: 28rpx;
  385. margin-bottom: 10rpx;
  386. color: $light-color;
  387. .num {
  388. font-size: 24rpx;
  389. color: #999999;
  390. }
  391. }
  392. }
  393. .goods-num {
  394. width: 60rpx;
  395. color: $main-color;
  396. }
  397. }
  398. }
  399. .after-num {
  400. margin: 0rpx 30rpx;
  401. display: flex;
  402. flex-direction: row;
  403. align-items: center;
  404. justify-content: space-between;
  405. height: 80rpx;
  406. }
  407. .opt-tip {
  408. margin-top: 20rpx;
  409. padding: 10rpx 30rpx;
  410. font-size: 22rpx;
  411. }
  412. .opt-view {
  413. background-color: #fff;
  414. margin-top: 20rpx;
  415. padding: 10rpx 30rpx;
  416. .how-view {
  417. display: flex;
  418. flex-direction: row;
  419. align-items: center;
  420. justify-content: space-between;
  421. height: 80rpx;
  422. border-bottom: 1px solid $page-color-base;
  423. }
  424. .explain-view {
  425. display: flex;
  426. flex-direction: row;
  427. align-items: center;
  428. height: 150rpx;
  429. }
  430. .img-title {
  431. height: 80rpx;
  432. display: flex;
  433. flex-direction: row;
  434. align-items: center;
  435. }
  436. .images-view {
  437. padding: 20rpx;
  438. display: flex;
  439. flex-direction: row;
  440. align-items: center;
  441. flex-wrap: wrap;
  442. }
  443. }
  444. .item-apply-voucher {
  445. width: 100%;
  446. display: flex;
  447. justify-content: flex-end;
  448. }
  449. .submit-view {
  450. position: fixed;
  451. z-index: 999;
  452. bottom: 0px;
  453. left: 0px;
  454. margin-top: 100rpx;
  455. border: solid 2rpx #f2f2f2;
  456. background-color: #ffffff;
  457. height: 100rpx;
  458. width: 750rpx;
  459. align-items: center;
  460. padding: 0rpx 20rpx;
  461. }
  462. </style>