refundMoney.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <view class="box">
  3. <view class="content">
  4. <view class="viewBg">
  5. <image src="../../static/img/icon_xinghao.png" mode="" style="width: 14rpx; height: 14rpx;"></image>
  6. <view class="leftTitle">退款原因</view>
  7. <picker class="width70" mode="selector" :range="reasonNameArray" @change="reasonChange">
  8. <view class="blackColor" :class="{grayColor: reason==''}">
  9. {{reason == '' ? '请选择' : reason}}
  10. </view>
  11. </picker>
  12. <image src="../../static/img/rightArrow.png" mode="" style="width: 13rpx; height: 23rpx;"></image>
  13. </view>
  14. <view class="moneyBg">
  15. <view class="viewBg2">
  16. <image src="../../static/img/icon_xinghao.png" mode="" style="width: 14rpx; height: 14rpx;"></image>
  17. <view class="leftTitle">退款金额</view>
  18. <input class="blackColor" type="digit" v-model="money" :placeholder="'最大可退 ¥'+maxMoney"
  19. placeholder-style="color:#999999" />
  20. </view>
  21. <view class="grayColor">如全额退款,优惠券会退回到您的账户</view>
  22. </view>
  23. <view class="contentBg">
  24. <view class="leftTitle">补充描述</view>
  25. <textarea placeholder-style="color:#999999" placeholder="选填,请输入补充描述" v-model="exeContent"
  26. class="textareaCont" maxlength="-1" auto-height="true" @confirm="feedDone" />
  27. </view>
  28. <view class="bottom">
  29. <view class="shoreDz" @click="submit">提交</view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. sheetId: '',
  39. reasonArray: [],
  40. reasonNameArray: [],
  41. reasonId: '',
  42. reason:'',
  43. maxMoney: '',
  44. money: '',
  45. exeContent: '',
  46. edit: '', //修改申请
  47. editId: '',
  48. }
  49. },
  50. onLoad(opt) {
  51. this.sheetId = opt.sheetId;
  52. this.maxMoney = opt.maxMoney;
  53. this.getRefundData();
  54. //修改申请
  55. this.edit = opt.edit;
  56. this.editId = opt.editId;
  57. this.money = opt.money;
  58. this.reasonId = opt.reasonId;
  59. this.reason = opt.reason;
  60. this.exeContent = opt.exeContent;
  61. if (opt.exeContent == null || opt.exeContent == 'null') {
  62. this.exeContent = ''
  63. }
  64. },
  65. methods: {
  66. submit() {
  67. console.log(this.money);
  68. if (!this.reasonId) {
  69. uni.showToast({
  70. title: '请选择退款原因',
  71. icon: 'none',
  72. duration: 2000,
  73. });
  74. return ;
  75. }
  76. if (this.money <= 0) {
  77. uni.showToast({
  78. title: '请输入大于0的金额',
  79. icon: 'none',
  80. duration: 2000,
  81. });
  82. return ;
  83. }
  84. if (this.money > this.maxMoney) {
  85. uni.showToast({
  86. title: '退款金额不能大于最大可退金额',
  87. icon: 'none',
  88. duration: 2000,
  89. });
  90. return ;
  91. }
  92. if (this.edit == 'true') {
  93. console.log('修改申请');
  94. this.editUrl();
  95. } else {
  96. this.addUrl();
  97. }
  98. },
  99. addUrl(){
  100. uni.showLoading({
  101. title: '处理中'
  102. })
  103. this.$http('worldKeepCar/orderRefund/applyRefund', {
  104. sheetId:this.sheetId,
  105. applyReasonId:this.reasonId,
  106. applyReason:this.reason,
  107. money:this.money,
  108. reasonComment: this.exeContent,
  109. }, 'POST').then(res => {
  110. uni.hideLoading();
  111. if(res.code==0){
  112. uni.showModal({
  113. title: '退款申请成功,请等待平台处理',
  114. content: '您可以在【我的-退款申请记录】里查看申请的处理进度哦',
  115. showCancel:false,
  116. confirmText:'知道了',
  117. success: function (res) {
  118. if (res.confirm) {
  119. uni.navigateBack({
  120. })
  121. }
  122. }
  123. });
  124. }
  125. })
  126. },
  127. editUrl(){
  128. uni.showLoading({
  129. title: '处理中'
  130. })
  131. this.$http('worldKeepCar/orderRefund/editApply', {
  132. applyReasonId:this.reasonId,
  133. applyReason:this.reason,
  134. money:this.money,
  135. reasonComment: this.exeContent,
  136. id:this.editId,
  137. }, 'POST').then(res => {
  138. uni.hideLoading();
  139. if(res.code==0){
  140. uni.showModal({
  141. title: '退款申请成功,请等待平台处理',
  142. content: '您可以在【我的-退款申请记录】里查看申请的处理进度哦',
  143. showCancel:false,
  144. confirmText:'知道了',
  145. success: function (res) {
  146. if (res.confirm) {
  147. uni.navigateBack({
  148. })
  149. }
  150. }
  151. });
  152. }
  153. })
  154. },
  155. getRefundData() {
  156. uni.showLoading({
  157. title: '加载中'
  158. })
  159. let url = 'worldKeepCar/orderRefund/refuseReasonList',
  160. params = {
  161. type: 3,
  162. }
  163. this.$http(url, params, 'GET').then(res => {
  164. uni.hideLoading();
  165. this.reasonArray = res.data
  166. this.reasonArray.forEach((item, index) => {
  167. this.reasonNameArray.push(item.contents)
  168. });
  169. })
  170. },
  171. feedDone(e) {
  172. this.exeContent = e.target.value
  173. },
  174. reasonChange(e) {
  175. this.reasonId = this.reasonArray[e.target.value].id
  176. this.reason = this.reasonArray[e.target.value].contents
  177. },
  178. }
  179. }
  180. </script>
  181. <style scoped>
  182. .box {
  183. min-height: 100vh;
  184. background: #F4F5F7;
  185. padding-top: 20rpx;
  186. }
  187. .content {
  188. background-color: #FFFFFF;
  189. border-radius: 10rpx;
  190. margin: 20rpx 24rpx;
  191. padding: 0 20rpx;
  192. }
  193. .viewBg {
  194. display: flex;
  195. align-items: center;
  196. padding: 30rpx 0;
  197. border-bottom: 1rpx solid #EEEEEE;
  198. }
  199. .width70 {
  200. width: 70%;
  201. }
  202. .moneyBg {
  203. padding: 30rpx 0;
  204. border-bottom: 1rpx solid #EEEEEE;
  205. }
  206. .viewBg2 {
  207. display: flex;
  208. align-items: center;
  209. margin-bottom: 20rpx;
  210. }
  211. .leftTitle {
  212. color: #333333;
  213. font-size: 28rpx;
  214. width: 130rpx;
  215. margin-right: 50rpx;
  216. }
  217. .blackColor {
  218. color: #333333;
  219. font-size: 28rpx;
  220. }
  221. .grayColor {
  222. color: #999999;
  223. font-size: 28rpx;
  224. }
  225. .textareaCont {
  226. width: 70%;
  227. font-size: 28rpx;
  228. color: #333333;
  229. }
  230. .contentBg {
  231. display: flex;
  232. align-items: center;
  233. padding: 30rpx 0;
  234. }
  235. .bottom {
  236. width: 750rpx;
  237. height: 120rpx;
  238. background: #FFFFFF;
  239. box-shadow: 0px -4px 8px 0px rgba(153, 153, 153, 0.08);
  240. position: fixed;
  241. left: 0;
  242. bottom: 0;
  243. display: flex;
  244. justify-content: space-around;
  245. }
  246. .shoreDz {
  247. width: 702rpx;
  248. height: 74rpx;
  249. background: linear-gradient(135deg, #FD5300 0%, #FF270A 100%);
  250. border-radius: 37rpx;
  251. text-align: center;
  252. line-height: 74rpx;
  253. color: #FFFFFF;
  254. font-size: 30rpx;
  255. margin-top: 24rpx;
  256. }
  257. </style>