apply.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  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="9" 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-expert.zhousi.hdlkeji.com/common/select2.png',
  126. icon2: 'https://ship-expert.zhousi.hdlkeji.com/common/select1.png',
  127. },
  128. {
  129. name: '退货退款',
  130. icon1: 'https://ship-expert.zhousi.hdlkeji.com/common/select2.png',
  131. icon2: 'https://ship-expert.zhousi.hdlkeji.com/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. }
  149. },
  150. onLoad(options) {
  151. that = this
  152. that.id = options.id
  153. that.getData()
  154. },
  155. methods: {
  156. getData() {
  157. $api.req({
  158. url: '/data/api.Order/order_info',
  159. method: "POST",
  160. data: {
  161. order_id: that.id
  162. }
  163. }, function(res) {
  164. if(res.code == 1) {
  165. that.pageData = res.data
  166. for(var i=0;i<that.pageData.goods_item.length;i++) {
  167. that.pageData.goods_item[i].goods_spec = $api.resetspec(that.pageData.goods_item[0].goods_spec)
  168. }
  169. }
  170. })
  171. },
  172. selectType(index) {
  173. that.active_type = index
  174. },
  175. // 选择退款原因
  176. selectReason() {
  177. that.show = true
  178. },
  179. selectState() {
  180. that.state_show = true
  181. },
  182. // 关闭
  183. close() {
  184. that.show = false
  185. that.state_show = false
  186. },
  187. radioChange(e) {
  188. console.log(e);
  189. that.reason = e
  190. },
  191. radioChange2(e) {
  192. that.state = e
  193. },
  194. // 确定
  195. sure() {
  196. if(that.reason !== '') {
  197. that.close()
  198. } else {
  199. $api.info('请先选择原因')
  200. }
  201. },
  202. sure2() {
  203. if(that.state !== '') {
  204. that.close()
  205. } else {
  206. $api.info('请先选择状态')
  207. }
  208. },
  209. applyRefund() {
  210. var images = ''
  211. for(var i=0;i<that.fileList1.length;i++) {
  212. images += that.fileList1[i].url + '|'
  213. }
  214. images = images.substr(0,images.length - 1)
  215. $api.req({
  216. url: '/data/api.Order/refund',
  217. method: 'POST',
  218. data: {
  219. type: that.typeList[that.active_type].name,
  220. status: that.state,
  221. order_id: that.id,
  222. reason: that.reason,
  223. desc: that.remarks,
  224. images: images
  225. }
  226. }, function(res) {
  227. if(res.code == 1) {
  228. $api.jump('/page_shop/pages/order/refundDetail?id=' + that.id)
  229. }
  230. })
  231. },
  232. // 删除图片
  233. deletePic(event) {
  234. this[`fileList${event.name}`].splice(event.index, 1)
  235. },
  236. // 新增图片
  237. async afterRead(event) {
  238. uni.showLoading({
  239. title: '上传中',
  240. mask: true
  241. })
  242. let lists = [].concat(event.file)
  243. let fileListLen = this[`fileList${event.name}`].length
  244. lists.map((item) => {
  245. this[`fileList${event.name}`].push({
  246. ...item,
  247. status: 'uploading',
  248. message: '上传中'
  249. })
  250. })
  251. for (let i = 0; i < lists.length; i++) {
  252. const result = await this.uploadFilePromise(lists[i].url)
  253. let item = this[`fileList${event.name}`][fileListLen]
  254. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  255. status: 'success',
  256. message: '',
  257. url: result.url
  258. }))
  259. fileListLen++
  260. if(lists.length - 1 == i) {
  261. uni.hideLoading()
  262. }
  263. }
  264. },
  265. uploadFilePromise(url) {
  266. return new Promise((resolve, reject) => {
  267. let a = uni.uploadFile({
  268. url: $api.config.baseUrl + '/data/api.auth.Center/upload',
  269. filePath: url,
  270. name: 'file',
  271. header: {
  272. 'content-type': 'application/x-www-form-urlencoded',
  273. 'api-token': uni.getStorageSync('token').token?uni.getStorageSync('token').token:'',
  274. 'api-name': 'wxapp'
  275. },
  276. formData: {
  277. user: 'test'
  278. },
  279. success: (res) => {
  280. setTimeout(() => {
  281. var data = JSON.parse(res.data)
  282. resolve(data.data)
  283. }, 1000)
  284. }
  285. });
  286. })
  287. },
  288. },
  289. }
  290. </script>
  291. <style lang="scss" scoped>
  292. .content::v-deep {
  293. background: #F4F4F4;
  294. padding: 0 30rpx;
  295. .box {
  296. margin-top: 20rpx;
  297. background: #FFFFFF;
  298. border-radius: 12px;
  299. box-sizing: border-box;
  300. padding: 28rpx 20rpx;
  301. .title {
  302. font-size: 32rpx;
  303. font-weight: 500;
  304. color: #222222;
  305. line-height: 44rpx;
  306. padding-bottom: 28rpx;
  307. }
  308. .img {
  309. width: 160rpx;
  310. height: 160rpx;
  311. border-radius: 24rpx;
  312. }
  313. .img_right {
  314. width:calc(100% - 160rpx);
  315. padding-left: 20rpx;
  316. .item_name {
  317. font-size: 30rpx;
  318. font-weight: 400;
  319. color: #222222;
  320. line-height: 42rpx;
  321. }
  322. .norm {
  323. max-width: 400rpx;
  324. width: max-content;
  325. // height: max-content;
  326. background: #F5F5F5;
  327. border-radius: 12rpx;
  328. box-sizing: border-box;
  329. padding: 12rpx 12rpx 6rpx;
  330. font-size: 20rpx;
  331. font-weight: 400;
  332. color: #888888;
  333. line-height: 28rpx;
  334. text-overflow: ellipsis;
  335. overflow: hidden;
  336. display: -webkit-box;
  337. -webkit-box-orient: vertical;
  338. box-orient: vertical;
  339. line-clamp: 2;
  340. -webkit-line-clamp: 2;
  341. }
  342. }
  343. .cell {
  344. padding: 16rpx 0 30rpx;
  345. .left {
  346. font-size: 28rpx;
  347. font-weight: 400;
  348. color: #222222;
  349. line-height: 40rpx;
  350. }
  351. .right {
  352. font-size: 24rpx;
  353. font-weight: bold;
  354. color: #EE5850;
  355. line-height: 28rpx;
  356. }
  357. }
  358. .bg {
  359. width: 100%;
  360. background: #F4F4F4;
  361. border-radius: 24rpx;
  362. // padding: 20rpx;
  363. box-sizing: border-box;
  364. .u-textarea {
  365. background-color: #F4F4F4;
  366. }
  367. .upload {
  368. width: 132rpx;
  369. height: 132rpx;
  370. border-radius: 16rpx;
  371. border: 1px dashed #C8C8C8;
  372. margin: 20rpx;
  373. .text {
  374. font-size: 20rpx;
  375. font-weight: 400;
  376. color: #A4A4A4;
  377. line-height: 28rpx;
  378. padding-top: 12rpx;
  379. }
  380. }
  381. .u-upload__wrap__preview {
  382. margin: 20rpx;
  383. }
  384. }
  385. .select_img {
  386. width: 31rpx;
  387. height: 31rpx;
  388. padding-right: 14rpx;
  389. }
  390. }
  391. .btn {
  392. margin-bottom: 74rpx;
  393. width: 100%;
  394. height: 84rpx;
  395. text-align: center;
  396. background: #506DFF;
  397. border-radius: 42rpx;
  398. font-size: 36rpx;
  399. font-weight: 500;
  400. color: #FFFFFF;
  401. line-height: 84rpx;
  402. }
  403. .popu {
  404. width: 100%;
  405. background: #FFFFFF;
  406. border-radius: 40rpx 40rpx 0px 0px;
  407. box-sizing: border-box;
  408. padding: 0 30rpx;
  409. .popu_title {
  410. width: 100%;
  411. text-align: center;
  412. padding: 48rpx 0 44rpx;
  413. font-size: 36rpx;
  414. font-weight: 500;
  415. color: #222222;
  416. line-height: 50rpx;
  417. }
  418. .popu_price {
  419. font-size: 36rpx;
  420. font-weight: 400;
  421. color: #FF2626;
  422. line-height: 44rpx;
  423. padding: 0 0 36rpx;
  424. }
  425. .type {
  426. font-size: 30rpx;
  427. font-weight: 400;
  428. color: #222222;
  429. line-height: 42rpx;
  430. }
  431. .way {
  432. width: 100%;
  433. margin: 28rpx 0 60rpx;
  434. background: #F4F4F4;
  435. border-radius: 12px;
  436. box-sizing: border-box;
  437. padding: 36rpx 20rpx;
  438. .pay_icon {
  439. width: 48rpx;
  440. height: 48rpx;
  441. margin-right: 20rpx;
  442. }
  443. }
  444. .sure_btn {
  445. margin: 200rpx 0 20rpx;
  446. width: 100%;
  447. height: 84rpx;
  448. background: #506DFF;
  449. border-radius: 42rpx;
  450. text-align: center;
  451. font-size: 32rpx;
  452. font-weight: 400;
  453. color: #FFFFFF;
  454. line-height: 84rpx;
  455. }
  456. .u-radio-group {
  457. flex: unset;
  458. }
  459. }
  460. }
  461. </style>