applyAfterSale.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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"></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="请输入联系方式"
  44. placeholderStyle="color: #555555" 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="value" 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. <!-- 退款原因选择 -->
  69. <u-picker :show="show" :columns="columns" confirmColor="#1E9F6A"></u-picker>
  70. <!-- <view class="" style="margin-bottom: 144rpx;"></view> -->
  71. <view class="navbar" @click="applyRefund">
  72. 申请退款
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. let that
  78. export default {
  79. data() {
  80. return {
  81. msg: '',
  82. value: '',
  83. fileList1: [],
  84. index: 0,
  85. info: {
  86. reason: "",
  87. amount: '',
  88. phone: "",
  89. memo: ''
  90. },
  91. show: false,
  92. Array: ['个人', '产品', '其他'],
  93. }
  94. },
  95. onLoad(o) {
  96. that=this
  97. let msg = JSON.parse(o.obj)
  98. this.msg = msg
  99. console.log(msg)
  100. },
  101. methods: {
  102. // 选择yuany
  103. bindPickerChange(e) {
  104. this.info.reason = this.Array[e.detail.value]
  105. },
  106. // 删除图片
  107. deletePic(event) {
  108. this[`fileList${event.name}`].splice(event.index, 1)
  109. },
  110. // 新增图片
  111. async afterRead(event) {
  112. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  113. let lists = [].concat(event.file)
  114. let fileListLen = this[`fileList${event.name}`].length
  115. lists.map((item) => {
  116. this[`fileList${event.name}`].push({
  117. ...item,
  118. status: 'uploading',
  119. message: '上传中'
  120. })
  121. })
  122. for (let i = 0; i < lists.length; i++) {
  123. const result = await this.uploadFilePromise(lists[i].url)
  124. let item = this[`fileList${event.name}`][fileListLen]
  125. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  126. status: 'success',
  127. message: '',
  128. url: result
  129. }))
  130. fileListLen++
  131. }
  132. },
  133. uploadFilePromise(url) {
  134. return new Promise((resolve, reject) => {
  135. let a = uni.uploadFile({
  136. url: 'https://t38.9026.com/api/common/upload', // 仅为示例,非真实的接口地址
  137. filePath: url,
  138. name: 'file',
  139. header: {
  140. Authorization: `Bearer ${token}`
  141. },
  142. formData: {
  143. user: 'test'
  144. },
  145. success: (res) => {
  146. console
  147. setTimeout(() => {
  148. resolve(res.data.data)
  149. }, 1000)
  150. }
  151. });
  152. })
  153. },
  154. applyRefund() {
  155. if(!this.info.reason){
  156. this.$toast("请选择退款原因")
  157. return
  158. }
  159. if(!this.info.amount){
  160. this.$toast("请输入退款金额")
  161. return
  162. }
  163. if(!this.info.phone){
  164. this.$toast("请输入手机号码")
  165. return
  166. }
  167. var pic=[]
  168. this.fileList1.forEach(item=>{
  169. pic.push(item.thumb)
  170. })
  171. this.info.picture=pic
  172. this.info.order_id=this.msg.id
  173. let form=this.info
  174. uni.showLoading({})
  175. uni.$u.http.post('/api/refund/add',form , {
  176. custom: {
  177. auth: true
  178. }
  179. }).then((res) => {
  180. uni.hideLoading()
  181. // uni.hideLoading()
  182. that.$toast("申请成功")
  183. setTimeout(() => {
  184. uni.navigateTo({
  185. url: "/pages/order/order"
  186. })
  187. }, 500)
  188. }).catch((err) => {
  189. uni.hideLoading()
  190. this.$toast(err.message)
  191. })
  192. },
  193. }
  194. }
  195. </script>
  196. <style lang="less">
  197. // .u-form-item__body.data-v-5e7216f1{
  198. // padding: 18px 0 !important;
  199. // }
  200. // .u-textarea.data-v-81cd9d32{
  201. // background-color:#F4F4F4 !important;
  202. // }
  203. page {
  204. background-color: #F4F4F4;
  205. font-size: 32rpx;
  206. }
  207. .applyAfterSale-top {
  208. margin: 24rpx 0 0;
  209. padding: 40rpx 30rpx;
  210. background: #FFFFFF;
  211. box-shadow: 0px 2rpx 4px 0px rgba(0, 0, 0, 0.02);
  212. border-radius: 16rpx 56rpx 8rpx 8rpx;
  213. display: flex;
  214. justify-content: space-between;
  215. align-items: center;
  216. .r {
  217. text-align: right;
  218. }
  219. image {
  220. width: 136rpx;
  221. height: 91rpx;
  222. border-radius: 6rpx;
  223. }
  224. }
  225. .applyAfterSale-center {
  226. margin-top: 24rpx;
  227. padding: 30rpx;
  228. background-color: #ffffff;
  229. border-radius: 8rpx 8rpx 16rpx 56rpx;
  230. padding-bottom: 40rpx;
  231. margin-bottom: 170rpx;
  232. }
  233. .navbar {
  234. padding: 30rpx 0;
  235. text-align: center;
  236. background: #1E9F6A;
  237. color: #fff;
  238. bottom: 0;
  239. margin: 0 auto;
  240. left: 0;
  241. position: fixed;
  242. width: 100%;
  243. border-radius: 16rpx 16rpx 0px 0px;
  244. }
  245. </style>