apply.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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.src" 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.name}}</view>
  11. <view class="item_name">{{pageData.price}}</view>
  12. </view>
  13. <view class="hflex jbetween" style="padding: 20rpx 0 0;">
  14. <view class="norm">{{pageData.norm}}</view>
  15. <view class="left_text">X{{pageData.num}}</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">{{money}}</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. <u-popup :show="show" :round="20" :closeable="true" mode="bottom" @close="close">
  65. <view class="popu">
  66. <view class="popu_title">退款原因</view>
  67. <view class="text_style2">请选择退款的原因(必选)</view>
  68. <u-radio-group v-model="reason" placement="column">
  69. <block v-for="(item, index) in cancelList" :key="index" >
  70. <u-radio :name="item.name" @change="radioChange" :customStyle="{padding: '28rpx 0'}" :label="item.name"></u-radio>
  71. </block>
  72. </u-radio-group>
  73. <view class="sure_btn" @click="sure">确定</view>
  74. </view>
  75. </u-popup>
  76. </view>
  77. <view class="btn" @click="applyRefund">申请退款</view>
  78. <u-popup :show="state_show" :round="20" :closeable="true" mode="bottom" @close="close">
  79. <view class="popu">
  80. <view class="popu_title">货物状态</view>
  81. <u-radio-group v-model="state" placement="column">
  82. <block v-for="(item, index) in stateList" :key="index" >
  83. <u-radio :name="item.name" @change="radioChange2" :customStyle="{padding: '28rpx 0'}" :label="item.name"></u-radio>
  84. </block>
  85. </u-radio-group>
  86. <view class="sure_btn" style="margin: 80rpx 0 20rpx;" @click="sure2">确定</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. src: '/static/images/index/class_img3.png',
  99. name: '扬子柴油发电机3kw/5kw…',
  100. price: '29.90',
  101. num: '1',
  102. remarks: '',
  103. norm: '规格类型:3kw单相手启动;颜色:黑色;配置:128G',
  104. },
  105. reason: '',
  106. state: '',
  107. money: '89.00',
  108. cancelList: [
  109. {
  110. name: '商品无货'
  111. },
  112. {
  113. name: '发货时间问题'
  114. },
  115. {
  116. name: '不想要了'
  117. },
  118. {
  119. name: '商品错选/多选'
  120. },
  121. {
  122. name: '地址信息填写错误'
  123. },
  124. {
  125. name: '其他原因'
  126. }
  127. ],
  128. typeList: [
  129. {
  130. name: '仅退款',
  131. icon1: '/static/images/comment/select2.png',
  132. icon2: '/static/images/comment/select1.png',
  133. },
  134. {
  135. name: '退货退款',
  136. icon1: '/static/images/comment/select2.png',
  137. icon2: '/static/images/comment/select1.png',
  138. }
  139. ],
  140. stateList: [
  141. {
  142. name: '未收到货'
  143. },
  144. {
  145. name: '已收到货'
  146. }
  147. ],
  148. active_type: 0,
  149. show: false,
  150. fileList1: [],
  151. active: 0,
  152. state_show: false
  153. }
  154. },
  155. onLoad() {
  156. that = this
  157. },
  158. methods: {
  159. selectType(index) {
  160. that.active_type = index
  161. },
  162. // 选择退款原因
  163. selectReason() {
  164. that.show = true
  165. },
  166. selectState() {
  167. that.state_show = true
  168. },
  169. // 关闭
  170. close() {
  171. that.show = false
  172. that.state_show = false
  173. },
  174. radioChange(e) {
  175. console.log(e);
  176. that.reason = e
  177. },
  178. radioChange2(e) {
  179. that.state = e
  180. },
  181. // 确定
  182. sure() {
  183. if(that.reason !== '') {
  184. that.close()
  185. } else {
  186. $api.info('请先选择原因')
  187. }
  188. },
  189. sure2() {
  190. if(that.state !== '') {
  191. that.close()
  192. } else {
  193. $api.info('请先选择状态')
  194. }
  195. },
  196. applyRefund() {
  197. $api.jump('/page_shop/pages/order/refundDetail')
  198. },
  199. // 删除图片
  200. deletePic(event) {
  201. this[`fileList${event.name}`].splice(event.index, 1)
  202. },
  203. // 新增图片
  204. async afterRead(event) {
  205. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  206. let lists = [].concat(event.file)
  207. let fileListLen = this[`fileList${event.name}`].length
  208. lists.map((item) => {
  209. this[`fileList${event.name}`].push({
  210. ...item,
  211. status: 'uploading',
  212. message: '上传中'
  213. })
  214. })
  215. for (let i = 0; i < lists.length; i++) {
  216. const result = await this.uploadFilePromise(lists[i].url)
  217. let item = this[`fileList${event.name}`][fileListLen]
  218. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  219. status: 'success',
  220. message: '',
  221. url: result
  222. }))
  223. fileListLen++
  224. }
  225. },
  226. uploadFilePromise(url) {
  227. return new Promise((resolve, reject) => {
  228. let a = uni.uploadFile({
  229. url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
  230. filePath: url,
  231. name: 'file',
  232. formData: {
  233. user: 'test'
  234. },
  235. success: (res) => {
  236. setTimeout(() => {
  237. resolve(res.data.data)
  238. }, 1000)
  239. }
  240. });
  241. })
  242. },
  243. },
  244. }
  245. </script>
  246. <style lang="scss" scoped>
  247. .content::v-deep {
  248. background: #F4F4F4;
  249. padding: 0 30rpx;
  250. .box {
  251. margin-top: 20rpx;
  252. background: #FFFFFF;
  253. border-radius: 12px;
  254. box-sizing: border-box;
  255. padding: 28rpx 20rpx;
  256. .title {
  257. font-size: 32rpx;
  258. font-weight: 500;
  259. color: #222222;
  260. line-height: 44rpx;
  261. padding-bottom: 28rpx;
  262. }
  263. .img {
  264. width: 160rpx;
  265. height: 160rpx;
  266. border-radius: 24rpx;
  267. }
  268. .img_right {
  269. width:calc(100% - 160rpx);
  270. padding-left: 20rpx;
  271. .item_name {
  272. font-size: 30rpx;
  273. font-weight: 400;
  274. color: #222222;
  275. line-height: 42rpx;
  276. }
  277. .norm {
  278. width: 288rpx;
  279. // height: 42px;
  280. background: #F5F5F5;
  281. border-radius: 12rpx;
  282. box-sizing: border-box;
  283. padding: 12rpx;
  284. font-size: 20rpx;
  285. font-weight: 400;
  286. color: #888888;
  287. line-height: 28rpx;
  288. }
  289. }
  290. .cell {
  291. padding: 16rpx 0 30rpx;
  292. .left {
  293. font-size: 28rpx;
  294. font-weight: 400;
  295. color: #222222;
  296. line-height: 40rpx;
  297. }
  298. .right {
  299. font-size: 24rpx;
  300. font-weight: bold;
  301. color: #EE5850;
  302. line-height: 28rpx;
  303. }
  304. }
  305. .bg {
  306. width: 100%;
  307. background: #F4F4F4;
  308. border-radius: 24rpx;
  309. // padding: 20rpx;
  310. box-sizing: border-box;
  311. .u-textarea {
  312. background-color: #F4F4F4;
  313. }
  314. .upload {
  315. width: 132rpx;
  316. height: 132rpx;
  317. border-radius: 16rpx;
  318. border: 1px dashed #C8C8C8;
  319. margin: 20rpx;
  320. .text {
  321. font-size: 20rpx;
  322. font-weight: 400;
  323. color: #A4A4A4;
  324. line-height: 28rpx;
  325. padding-top: 12rpx;
  326. }
  327. }
  328. .u-upload__wrap__preview {
  329. margin: 20rpx;
  330. }
  331. }
  332. .select_img {
  333. width: 31rpx;
  334. height: 31rpx;
  335. padding-right: 14rpx;
  336. }
  337. }
  338. .btn {
  339. margin-bottom: 74rpx;
  340. width: 100%;
  341. height: 84rpx;
  342. text-align: center;
  343. background: #506DFF;
  344. border-radius: 42rpx;
  345. font-size: 36rpx;
  346. font-weight: 500;
  347. color: #FFFFFF;
  348. line-height: 84rpx;
  349. }
  350. .popu {
  351. width: 100%;
  352. background: #FFFFFF;
  353. border-radius: 40rpx 40rpx 0px 0px;
  354. box-sizing: border-box;
  355. padding: 0 30rpx;
  356. .popu_title {
  357. width: 100%;
  358. text-align: center;
  359. padding: 48rpx 0 44rpx;
  360. font-size: 36rpx;
  361. font-weight: 500;
  362. color: #222222;
  363. line-height: 50rpx;
  364. }
  365. .popu_price {
  366. font-size: 36rpx;
  367. font-weight: 400;
  368. color: #FF2626;
  369. line-height: 44rpx;
  370. padding: 0 0 36rpx;
  371. }
  372. .type {
  373. font-size: 30rpx;
  374. font-weight: 400;
  375. color: #222222;
  376. line-height: 42rpx;
  377. }
  378. .way {
  379. width: 100%;
  380. margin: 28rpx 0 60rpx;
  381. background: #F4F4F4;
  382. border-radius: 12px;
  383. box-sizing: border-box;
  384. padding: 36rpx 20rpx;
  385. .pay_icon {
  386. width: 48rpx;
  387. height: 48rpx;
  388. margin-right: 20rpx;
  389. }
  390. }
  391. .sure_btn {
  392. margin: 200rpx 0 20rpx;
  393. width: 100%;
  394. height: 84rpx;
  395. background: #506DFF;
  396. border-radius: 42rpx;
  397. text-align: center;
  398. font-size: 32rpx;
  399. font-weight: 400;
  400. color: #FFFFFF;
  401. line-height: 84rpx;
  402. }
  403. .u-radio-group {
  404. flex: unset;
  405. }
  406. }
  407. }
  408. </style>