apply.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <view class="content vflex jbetween">
  3. <view>
  4. <view class="box">
  5. <view class="title">退款商品</view>
  6. <view class="hflex acenter ">
  7. <image :src="pageData.goods_item[0].goods_cover" mode="aspectFill" class="img"></image>
  8. <view class="img_right">
  9. <view class="hflex acenter jbetween">
  10. <view class="item_name text_hide" style="width: 374rpx;">{{pageData.goods_item[0].goods_name}}</view>
  11. <view class="item_name">{{pageData.goods_item[0].price_selling}}</view>
  12. </view>
  13. <view class="hflex jbetween" style="padding: 20rpx 0 0;">
  14. <view class="norm">{{pageData.goods_item[0].goods_spec}}</view>
  15. <view class="left_text">X{{pageData.goods_item[0].stock_sales}}</view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <!-- <view class="box">
  21. <view class="title">选择退款类型</view>
  22. <view class="hflex acenter">
  23. <block v-for="(item,index) in typeList" :key="index">
  24. <view class="hflex acenter" style="padding-right: 80rpx;" @click="selectType(index)">
  25. <image :src="active_type == index ? item.icon1 : item.icon2" class="select_img"></image>
  26. <view class="select_text">{{item.name}}</view>
  27. </view>
  28. </block>
  29. </view>
  30. </view> -->
  31. <view class="box">
  32. <view class="title">退款信息</view>
  33. <!-- <view class="hflex acenter jbetween cell" @click="selectState" v-if="active_type == 0">
  34. <view class="left">货物状态</view>
  35. <u-input v-model="state" inputAlign="right" disabled disabledColor="#fff" placeholder="请选择货物状态>" border="none"></u-input>
  36. </view> -->
  37. <view class="hflex acenter jbetween cell" @click="selectReason">
  38. <view class="left">退款原因</view>
  39. <u-input v-model="reason" inputAlign="right" disabled disabledColor="#fff" placeholder="请选择退款原因>" border="none"></u-input>
  40. </view>
  41. <view class="hflex acenter jbetween cell">
  42. <view class="left">退款金额</view>
  43. <view class="right">{{pageData.payment_amount}}</view>
  44. </view>
  45. </view>
  46. <!-- <view class="box" v-if="active_type == 1">
  47. <view class="hflex acenter jbetween">
  48. <view class="left" style="font-size: 30rpx;font-weight: 500;">退货方式</view>
  49. <view class="left">自行寄回</view>
  50. </view>
  51. </view> -->
  52. <view class="box">
  53. <view class="title">补充描述和凭证</view>
  54. <view class="bg">
  55. <u-textarea autoHeight v-model="remarks" placeholder="补充描述,便于商家更好的处理售后问题" border="none"></u-textarea>
  56. <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="3" width="132rpx" height="132rpx">
  57. <view class="upload vflex acenter jcenter">
  58. <u-icon name="camera" color="#B5B5B5" size="18"></u-icon>
  59. <view class="text">上传凭证</view>
  60. </view>
  61. </u-upload>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="btn" @click="applyRefund">申请退款</view>
  66. <u-popup :show="state_show" :round="20" :closeable="true" mode="bottom" @close="close">
  67. <view class="popu">
  68. <view class="popu_title">货物状态</view>
  69. <u-radio-group v-model="state" placement="column">
  70. <block v-for="(item, index) in stateList" :key="index" >
  71. <u-radio :name="item.name" @change="radioChange2" :customStyle="{padding: '28rpx 0'}" :label="item.name"></u-radio>
  72. </block>
  73. </u-radio-group>
  74. <view class="sure_btn" style="margin: 80rpx 0 20rpx;" @click="sure2">确定</view>
  75. </view>
  76. </u-popup>
  77. <u-popup :show="show" :round="20" :closeable="true" mode="bottom" @close="close">
  78. <view class="popu">
  79. <view class="popu_title">退款原因</view>
  80. <view class="text_style2">请选择退款的原因(必选)</view>
  81. <u-radio-group v-model="reason" placement="column">
  82. <block v-for="(item, index) in cancelList" :key="index" >
  83. <u-radio :name="item.name" @change="radioChange" :customStyle="{padding: '28rpx 0'}" :label="item.name"></u-radio>
  84. </block>
  85. </u-radio-group>
  86. <view class="sure_btn" @click="sure">确定</view>
  87. </view>
  88. </u-popup>
  89. </view>
  90. </template>
  91. <script>
  92. import $api from '@/static/js/api.js'
  93. var that = ''
  94. export default {
  95. data() {
  96. return {
  97. pageData: {
  98. },
  99. reason: '',
  100. state: '',
  101. money: '89.00',
  102. cancelList: [
  103. {
  104. name: '商品无货'
  105. },
  106. {
  107. name: '发货时间问题'
  108. },
  109. {
  110. name: '不想要了'
  111. },
  112. {
  113. name: '商品错选/多选'
  114. },
  115. {
  116. name: '地址信息填写错误'
  117. },
  118. {
  119. name: '其他原因'
  120. }
  121. ],
  122. typeList: [
  123. {
  124. name: '仅退款',
  125. icon1: 'https://ship.shipcc.cn/common/select2.png',
  126. icon2: 'https://ship.shipcc.cn/common/select1.png',
  127. },
  128. {
  129. name: '退货退款',
  130. icon1: 'https://ship.shipcc.cn/common/select2.png',
  131. icon2: 'https://ship.shipcc.cn/common/select1.png',
  132. }
  133. ],
  134. stateList: [
  135. {
  136. name: '未收到货'
  137. },
  138. {
  139. name: '已收到货'
  140. }
  141. ],
  142. active_type: 0,
  143. show: false,
  144. fileList1: [],
  145. active: 0,
  146. state_show: false,
  147. id: '',
  148. remarks: ''
  149. }
  150. },
  151. onLoad(options) {
  152. that = this
  153. that.id = options.id
  154. that.getData()
  155. },
  156. methods: {
  157. getData() {
  158. $api.req({
  159. url: '/data/api.Order/order_info',
  160. method: "POST",
  161. data: {
  162. order_id: that.id
  163. }
  164. }, function(res) {
  165. if(res.code == 1) {
  166. that.pageData = res.data
  167. for(var i=0;i<that.pageData.goods_item.length;i++) {
  168. that.pageData.goods_item[i].goods_spec = $api.resetspec(that.pageData.goods_item[0].goods_spec)
  169. }
  170. }
  171. })
  172. },
  173. selectType(index) {
  174. that.active_type = index
  175. },
  176. // 选择退款原因
  177. selectReason() {
  178. that.show = true
  179. },
  180. selectState() {
  181. that.state_show = true
  182. },
  183. // 关闭
  184. close() {
  185. that.show = false
  186. that.state_show = false
  187. },
  188. radioChange(e) {
  189. console.log(e);
  190. that.reason = e
  191. },
  192. radioChange2(e) {
  193. that.state = e
  194. },
  195. // 确定
  196. sure() {
  197. if(that.reason !== '') {
  198. that.close()
  199. } else {
  200. $api.info('请先选择原因')
  201. }
  202. },
  203. sure2() {
  204. if(that.state !== '') {
  205. that.close()
  206. } else {
  207. $api.info('请先选择状态')
  208. }
  209. },
  210. applyRefund() {
  211. var images = ''
  212. for(var i=0;i<that.fileList1.length;i++) {
  213. images += that.fileList1[i].url + '|'
  214. }
  215. images = images.substr(0,images.length - 1)
  216. $api.req({
  217. url: '/data/api.Order/refund',
  218. method: 'POST',
  219. data: {
  220. type: that.typeList[that.active_type].name,
  221. status: that.state,
  222. order_id: that.id,
  223. reason: that.reason,
  224. desc: that.remarks,
  225. images: images
  226. }
  227. }, function(res) {
  228. if(res.code == 1) {
  229. $api.jump('/page_shop/pages/order/refundDetail?id=' + that.id)
  230. }
  231. })
  232. },
  233. // 删除图片
  234. deletePic(event) {
  235. this[`fileList${event.name}`].splice(event.index, 1)
  236. },
  237. // 新增图片
  238. async afterRead(event) {
  239. uni.showLoading({
  240. title: '上传中',
  241. mask: true
  242. })
  243. let lists = [].concat(event.file)
  244. let fileListLen = this[`fileList${event.name}`].length
  245. lists.map((item) => {
  246. this[`fileList${event.name}`].push({
  247. ...item,
  248. status: 'uploading',
  249. message: '上传中'
  250. })
  251. })
  252. for (let i = 0; i < lists.length; i++) {
  253. const result = await this.uploadFilePromise(lists[i].url)
  254. let item = this[`fileList${event.name}`][fileListLen]
  255. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  256. status: 'success',
  257. message: '',
  258. url: result.url
  259. }))
  260. fileListLen++
  261. if(lists.length - 1 == i) {
  262. uni.hideLoading()
  263. }
  264. }
  265. },
  266. uploadFilePromise(url) {
  267. return new Promise((resolve, reject) => {
  268. let a = uni.uploadFile({
  269. url: $api.config.baseUrl + '/data/api.auth.Center/upload',
  270. filePath: url,
  271. name: 'file',
  272. header: {
  273. 'content-type': 'application/x-www-form-urlencoded',
  274. 'api-token': uni.getStorageSync('token').token?uni.getStorageSync('token').token:'',
  275. 'api-name': 'wxapp'
  276. },
  277. formData: {
  278. user: 'test'
  279. },
  280. success: (res) => {
  281. setTimeout(() => {
  282. var data = JSON.parse(res.data)
  283. resolve(data.data)
  284. }, 1000)
  285. }
  286. });
  287. })
  288. },
  289. },
  290. }
  291. </script>
  292. <style lang="scss" scoped>
  293. .content::v-deep {
  294. background: #F4F4F4;
  295. padding: 0 30rpx;
  296. .box {
  297. margin-top: 20rpx;
  298. background: #FFFFFF;
  299. border-radius: 12px;
  300. box-sizing: border-box;
  301. padding: 28rpx 20rpx;
  302. .title {
  303. font-size: 32rpx;
  304. font-weight: 500;
  305. color: #222222;
  306. line-height: 44rpx;
  307. padding-bottom: 28rpx;
  308. }
  309. .img {
  310. width: 160rpx;
  311. height: 160rpx;
  312. border-radius: 24rpx;
  313. }
  314. .img_right {
  315. width:calc(100% - 160rpx);
  316. padding-left: 20rpx;
  317. .item_name {
  318. font-size: 30rpx;
  319. font-weight: 400;
  320. color: #222222;
  321. line-height: 42rpx;
  322. }
  323. .norm {
  324. max-width: 400rpx;
  325. width: max-content;
  326. // height: max-content;
  327. background: #F5F5F5;
  328. border-radius: 12rpx;
  329. box-sizing: border-box;
  330. padding: 12rpx 12rpx 6rpx;
  331. font-size: 20rpx;
  332. font-weight: 400;
  333. color: #888888;
  334. line-height: 28rpx;
  335. text-overflow: ellipsis;
  336. overflow: hidden;
  337. display: -webkit-box;
  338. -webkit-box-orient: vertical;
  339. box-orient: vertical;
  340. line-clamp: 2;
  341. -webkit-line-clamp: 2;
  342. }
  343. }
  344. .cell {
  345. padding: 16rpx 0 30rpx;
  346. .left {
  347. font-size: 28rpx;
  348. font-weight: 400;
  349. color: #222222;
  350. line-height: 40rpx;
  351. }
  352. .right {
  353. font-size: 24rpx;
  354. font-weight: bold;
  355. color: #EE5850;
  356. line-height: 28rpx;
  357. }
  358. }
  359. .bg {
  360. width: 100%;
  361. background: #F4F4F4;
  362. border-radius: 24rpx;
  363. // padding: 20rpx;
  364. box-sizing: border-box;
  365. .u-textarea {
  366. background-color: #F4F4F4;
  367. }
  368. .upload {
  369. width: 132rpx;
  370. height: 132rpx;
  371. border-radius: 16rpx;
  372. border: 1px dashed #C8C8C8;
  373. margin: 20rpx;
  374. .text {
  375. font-size: 20rpx;
  376. font-weight: 400;
  377. color: #A4A4A4;
  378. line-height: 28rpx;
  379. padding-top: 12rpx;
  380. }
  381. }
  382. .u-upload__wrap__preview {
  383. margin: 20rpx;
  384. }
  385. }
  386. .select_img {
  387. width: 31rpx;
  388. height: 31rpx;
  389. padding-right: 14rpx;
  390. }
  391. }
  392. .btn {
  393. margin-bottom: 74rpx;
  394. width: 100%;
  395. height: 84rpx;
  396. text-align: center;
  397. background: #506DFF;
  398. border-radius: 42rpx;
  399. font-size: 36rpx;
  400. font-weight: 500;
  401. color: #FFFFFF;
  402. line-height: 84rpx;
  403. }
  404. .popu {
  405. width: 100%;
  406. background: #FFFFFF;
  407. border-radius: 40rpx 40rpx 0px 0px;
  408. box-sizing: border-box;
  409. padding: 0 30rpx;
  410. .popu_title {
  411. width: 100%;
  412. text-align: center;
  413. padding: 48rpx 0 44rpx;
  414. font-size: 36rpx;
  415. font-weight: 500;
  416. color: #222222;
  417. line-height: 50rpx;
  418. }
  419. .popu_price {
  420. font-size: 36rpx;
  421. font-weight: 400;
  422. color: #FF2626;
  423. line-height: 44rpx;
  424. padding: 0 0 36rpx;
  425. }
  426. .type {
  427. font-size: 30rpx;
  428. font-weight: 400;
  429. color: #222222;
  430. line-height: 42rpx;
  431. }
  432. .way {
  433. width: 100%;
  434. margin: 28rpx 0 60rpx;
  435. background: #F4F4F4;
  436. border-radius: 12px;
  437. box-sizing: border-box;
  438. padding: 36rpx 20rpx;
  439. .pay_icon {
  440. width: 48rpx;
  441. height: 48rpx;
  442. margin-right: 20rpx;
  443. }
  444. }
  445. .sure_btn {
  446. margin: 200rpx 0 20rpx;
  447. width: 100%;
  448. height: 84rpx;
  449. background: #506DFF;
  450. border-radius: 42rpx;
  451. text-align: center;
  452. font-size: 32rpx;
  453. font-weight: 400;
  454. color: #FFFFFF;
  455. line-height: 84rpx;
  456. }
  457. .u-radio-group {
  458. flex: unset;
  459. }
  460. }
  461. }
  462. </style>