applyAfterSale.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <view class="">
  3. <view class="applyAfterSale-top">
  4. <view class="l">
  5. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  6. {{msg.good_name}}
  7. </view>
  8. <view class="" style="font-size: 22rpx;margin: 20rpx 0;">
  9. 出行日期:{{msg.start_at}}
  10. </view>
  11. <view class="" style="font-size: 22rpx;">
  12. 数量 {{msg.number}}
  13. </view>
  14. </view>
  15. <view class="r">
  16. <image :src="msg.cover_picture" mode="aspectFill"></image>
  17. <view class="" style="margin-top: 20rpx;">
  18. <text style="font-size: 22rpx;">订单金额</text><text
  19. style="font-size: 32rpx;font-weight: 600;padding-left: 10rpx;">¥{{msg.amount}}</text>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="applyAfterSale-center">
  24. <u--form :model="form">
  25. <u-form-item label="退款原因" labelWidth=200 prop="info.reason" borderBottom ref="item1" :required="true">
  26. <picker @change="bindPickerChange" :value="info.reason" :range="Array">
  27. <view class="" style="display: flex;">
  28. <u--input v-model="info.reason" disabled disabledColor="#ffffff" border="none"
  29. placeholder="请输入退款原因" placeholderStyle="color: #555555"></u--input>
  30. <u-icon slot="right" name="arrow-right"></u-icon>
  31. </view>
  32. </picker>
  33. </u-form-item>
  34. <u-form-item label="退款金额" labelWidth=200 prop="info.amount" borderBottom ref="item1" :required="true">
  35. <u--input v-model="info.amount" border="none" :placeholder="'最多可退款'+msg.amount"
  36. placeholderStyle="color: #555555" type="digit"></u--input>
  37. </u-form-item>
  38. <!-- <u-form-item label="备注信息" labelWidth=200 prop="info.memo" borderBottom ref="item1">
  39. <u--input v-model="info.memo" border="none" placeholder="请输入备注" placeholderStyle="color: #555555">
  40. </u--input>
  41. </u-form-item> -->
  42. <u-form-item label="联系方式" labelWidth=200 prop="info.phone" borderBottom ref="item1" :required="true">
  43. <u--input v-model="info.phone" border="none" placeholder="请输入联系方式" placeholderStyle="color: #555555"
  44. type="number"></u--input>
  45. </u-form-item>
  46. <view class="">
  47. <view class="" style="margin: 40rpx 0;">
  48. 备注信息
  49. </view>
  50. <u--textarea v-model="info.memo" placeholder="请输入退款原因" :customStyle="{'background':'#F4F4F4'}"
  51. placeholderStyle="color: #555555" height=160 border="none"></u--textarea>
  52. </view>
  53. <view class="" style="font-size: 36rpx;font-weight: 600;margin: 24rpx 0;">
  54. 退款说明
  55. </view>
  56. <view class="" style="margin-bottom: 40rpx;">
  57. 退款将退到原账户,请知悉!
  58. </view>
  59. <view class="applyAfterSale-footer">
  60. <view class="" style="margin: 20rpx 0;">
  61. 上传凭证
  62. </view>
  63. <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
  64. :maxCount="6" width="200rpx" height="200rpx"></u-upload>
  65. </view>
  66. </u--form>
  67. </view>
  68. <view style="margin-bottom: 170rpx;"></view>
  69. <!-- 退款原因选择 -->
  70. <u-picker :show="show" :columns="columns" confirmColor="#1E9F6A"></u-picker>
  71. <!-- <view class="" style="margin-bottom: 144rpx;"></view> -->
  72. <view class="navbar" @click="applyRefund">
  73. 申请退款
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. let that
  79. export default {
  80. data() {
  81. return {
  82. msg: '',
  83. value: '',
  84. fileList1: [],
  85. index: 0,
  86. info: {
  87. reason: "",
  88. amount: '',
  89. phone: "",
  90. memo: ''
  91. },
  92. show: false,
  93. Array: ['个人', '产品', '其他'],
  94. photolist: []
  95. }
  96. },
  97. onLoad(o) {
  98. that = this
  99. if (o.obj) {
  100. let msg = JSON.parse(decodeURIComponent(o.obj))
  101. this.msg = msg
  102. }
  103. },
  104. methods: {
  105. // 选择yuany
  106. bindPickerChange(e) {
  107. this.info.reason = this.Array[e.detail.value]
  108. },
  109. // 删除图片
  110. deletePic(event) {
  111. this[`fileList${event.name}`].splice(event.index, 1)
  112. },
  113. // 新增图片
  114. async afterRead(event) {
  115. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  116. let lists = [].concat(event.file)
  117. let fileListLen = this[`fileList${event.name}`].length
  118. lists.map((item) => {
  119. this[`fileList${event.name}`].push({
  120. ...item,
  121. status: 'uploading',
  122. message: '上传中'
  123. })
  124. })
  125. for (let i = 0; i < lists.length; i++) {
  126. const result = await this.uploadFilePromise(lists[i].url)
  127. let item = this[`fileList${event.name}`][fileListLen]
  128. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  129. status: 'success',
  130. message: '',
  131. url: result
  132. }))
  133. fileListLen++
  134. }
  135. },
  136. uploadFilePromise(url) {
  137. let token = uni.getStorageSync("token")
  138. return new Promise((resolve, reject) => {
  139. let a = uni.uploadFile({
  140. url: 'https://t38.9026.com/api/common/upload', // 仅为示例,非真实的接口地址
  141. filePath: url,
  142. name: 'file',
  143. header: {
  144. Authorization: `Bearer ${token}`
  145. },
  146. formData: {
  147. user: 'test'
  148. },
  149. success: (res) => {
  150. let pic = JSON.parse(res.data)
  151. this.photolist.push(pic.data.url)
  152. setTimeout(() => {
  153. resolve(res.data.data)
  154. }, 1000)
  155. }
  156. });
  157. })
  158. },
  159. applyRefund() {
  160. if (!this.info.reason) {
  161. this.$toast("请选择退款原因")
  162. return
  163. }
  164. if (!this.info.amount) {
  165. this.$toast("请输入退款金额")
  166. return
  167. }
  168. if (!this.info.phone) {
  169. this.$toast("请输入手机号码")
  170. return
  171. }
  172. var pic = []
  173. this.fileList1.forEach(item => {
  174. pic.push(item.thumb)
  175. })
  176. this.info.picture = this.photolist
  177. this.info.order_id = this.msg.id
  178. let form = this.info
  179. uni.showLoading({})
  180. uni.$u.http.post('/api/refund/add', form, {
  181. custom: {
  182. auth: true
  183. }
  184. }).then((res) => {
  185. uni.hideLoading()
  186. // uni.hideLoading()
  187. that.$toast("申请成功")
  188. setTimeout(() => {
  189. uni.navigateTo({
  190. url: "/pages/order/order"
  191. })
  192. }, 500)
  193. }).catch((err) => {
  194. uni.hideLoading()
  195. this.$toast(err.message)
  196. })
  197. },
  198. }
  199. }
  200. </script>
  201. <style lang="less">
  202. // .u-form-item__body.data-v-5e7216f1{
  203. // padding: 18px 0 !important;
  204. // }
  205. // .u-textarea.data-v-81cd9d32{
  206. // background-color:#F4F4F4 !important;
  207. // }
  208. page {
  209. background-color: #F4F4F4;
  210. font-size: 32rpx;
  211. }
  212. .applyAfterSale-top {
  213. margin: 24rpx 0 0;
  214. padding: 40rpx 30rpx;
  215. background: #FFFFFF;
  216. box-shadow: 0px 2rpx 4px 0px rgba(0, 0, 0, 0.02);
  217. border-radius: 16rpx 56rpx 8rpx 8rpx;
  218. display: flex;
  219. justify-content: space-between;
  220. align-items: center;
  221. .r {
  222. text-align: right;
  223. }
  224. image {
  225. width: 136rpx;
  226. height: 91rpx;
  227. border-radius: 6rpx;
  228. }
  229. }
  230. .applyAfterSale-center {
  231. margin-top: 24rpx;
  232. padding: 30rpx;
  233. background-color: #ffffff;
  234. border-radius: 8rpx 8rpx 16rpx 56rpx;
  235. padding-bottom: 40rpx;
  236. }
  237. .navbar {
  238. padding: 30rpx 0;
  239. text-align: center;
  240. background: #1E9F6A;
  241. color: #fff;
  242. bottom: 0;
  243. margin: 0 auto;
  244. left: 0;
  245. position: fixed;
  246. width: 100%;
  247. border-radius: 16rpx 16rpx 0px 0px;
  248. }
  249. </style>