group-refund.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view class="flex-common-css iPhone-bottom box-border-box">
  3. <Nav title="申请退款" leftIconColor="#333" titleColor="#333" bgckgroundBox='transparent'></Nav>
  4. <scroll-view :scroll-y="true" class="scroll-view-css p-24 box-border-box" @scrolltolower="scrolltolower">
  5. <view class="b-rad-20 bgc-f p-24 box-border-box">
  6. <view class="align-items-center p-b-20 mb-20 b-b-F9F9F9">
  7. <image :src="goods_info.goods_img" mode="scaleToFill" class="goods-img mr-24"></image>
  8. <view class="fs-28 fc-3 fw-500">
  9. {{goods_info.goods_name}}
  10. </view>
  11. </view>
  12. <view class="align-items-center flex-justify-space p-b-20 mb-20 b-b-F9F9F9">
  13. <view class="">
  14. <view class="mb-8 fs-30 fc-3 fw-b">
  15. 退款数量
  16. </view>
  17. <view class="fs-24 fc-9">
  18. 最多可退 {{(Number(this.goods_info.goods_number) - Number(this.goods_info.finish_number) - Number(this.goods_info.refund_number))}} 张
  19. </view>
  20. </view>
  21. <view class="align-items-center">
  22. <image src="@/static/img/takeout/j.png" mode="" class="j" @click="setNum(1)"></image>
  23. <input type="number" v-model="fromData.number" class="input" @blur='blur' />
  24. <image src="@/static/img/takeout/add.png" mode="" class="j" @click="setNum(2)"></image>
  25. </view>
  26. </view>
  27. <view class="p-b-20 mb-20 b-b-F9F9F9">
  28. <view class="align-items-center flex-justify-space mb-8">
  29. <view class="fs-30 fc-3 fw-b">
  30. 退款金额
  31. </view>
  32. <view class="fs-20 fw-600 fc-41ABF5">
  33. ¥<span
  34. class="fs-34 fw-600 fc-41ABF5">{{(Number(goods_info.goods_price) * Number(fromData.number)).toFixed(2)}}</span>
  35. </view>
  36. </view>
  37. <view class="fs-22 fc-9">
  38. 1-3 个工作日退还至原支付方,以实际退款金额为准
  39. </view>
  40. </view>
  41. <view class="align-items-center flex-justify-space">
  42. <view class="fs-30 fc-3 fw-b flex-shrink0">
  43. 退款原因
  44. </view>
  45. <view class="align-items-center flex-justify-end flex-1" @click="openPop">
  46. <view class="fs-26 fc-3 mr-8">
  47. {{refund_id != 0?fromData.refund_msg:'请选择'}}
  48. </view>
  49. <uni-icons type="right" size="13" color='#333'></uni-icons>
  50. </view>
  51. </view>
  52. </view>
  53. </scroll-view>
  54. <view class="bgc-f p-24 box-border-box align-items-flex-end flex-justify-space">
  55. <view class="fs-34 fw-600 fc-41ABF5">
  56. <span class="fs-24 fc-41ABF5 fw-400 mr-12">退款金额</span>
  57. <span class="fs-20 fw-600 fc-41ABF5">¥</span>
  58. {{(Number(goods_info.goods_price) * Number(fromData.number)).toFixed(2)}}
  59. </view>
  60. <view class="but bgc-41ABF5 fc-f b-rad-200 text-align-center fs-34" @click="groupOrderRefund">
  61. 提交
  62. </view>
  63. </view>
  64. <uni-popup ref="popup" type="bottom" border-radius="10px 10px 0 0" background-color='#fff'>
  65. <view class="pop-box p-24 box-border-box">
  66. <view class="fs-30 fc-3 fw-b mb-20 text-align-center">
  67. 退款原因
  68. </view>
  69. <uni-icons class="pop-gb" type="closeempty" size="20"></uni-icons>
  70. <view class="scroll-view-css">
  71. <view class="align-items-center flex-justify-space p-24 box-border-box"
  72. v-for="(item,index) in refund_reason" :key="index" @click="popSelect(item.id,index)">
  73. <view class="fs-30" :class="refund_id == item.id?'fc-41ABF5':'fc-3'">
  74. {{item.refund_msg}}
  75. </view>
  76. <uni-icons color='#41ABF5' v-if="refund_id == item.id" type="checkbox-filled"
  77. size="20"></uni-icons>
  78. <uni-icons color='#333' v-else type="circle" size="20"></uni-icons>
  79. </view>
  80. </view>
  81. <view class="align-items-center p-24 box-border-box">
  82. <view class="pop-b flex-1 mr-16 text-align-center fs-30 fc-3 b-rad-200 bgc-E6E6E6" @click="popOn">
  83. 取消
  84. </view>
  85. <view class="pop-b flex-1 text-align-center fs-30 fc-f b-rad-200 bgc-41ABF5" @click="popOk">
  86. 确定
  87. </view>
  88. </view>
  89. </view>
  90. </uni-popup>
  91. </view>
  92. </template>
  93. <script>
  94. import {
  95. groupOrderInfo,
  96. groupOrderRefund
  97. } from "@/api/groupOrder.js"
  98. import {
  99. commonRefundReason
  100. } from "@/api/common.js"
  101. import tools from "@/service/tools";
  102. export default {
  103. components: {},
  104. data() {
  105. return {
  106. fromData: {
  107. order_id: 0,
  108. number: 1,
  109. refund_msg: '请选择'
  110. },
  111. refund_id: 0,
  112. refund_index: 0,
  113. refund_reason: [],
  114. goods_info: {},
  115. is_ajax: false
  116. };
  117. },
  118. onLoad(data) {
  119. if (data) {
  120. this.fromData.order_id = data.order_id
  121. this.groupOrderInfo()
  122. this.commonRefundReason()
  123. }
  124. },
  125. mounted() {},
  126. methods: {
  127. groupOrderRefund() {
  128. if (this.refund_id === 0 || this.fromData.refund_msg === '请选择') {
  129. tools.error('请选择退款原因')
  130. return
  131. }
  132. if (this.is_ajax) {
  133. return
  134. }
  135. this.is_ajax = true
  136. groupOrderRefund(this.fromData).then((res) => {
  137. if (res.code === 1) {
  138. tools.success(res.msg)
  139. this.is_ajax = false
  140. setTimeout(() => {
  141. uni.$emit('groupRefund', this.fromData.order_id)
  142. tools.leftClick()
  143. }, 1000)
  144. } else {
  145. tools.error(res.msg)
  146. this.is_ajax = false
  147. }
  148. })
  149. },
  150. popOk() {
  151. this.$refs.popup.close()
  152. this.fromData.refund_msg = this.refund_reason[this.refund_index].refund_msg
  153. },
  154. popSelect(id, index) {
  155. this.refund_id = id
  156. this.refund_index = index
  157. },
  158. commonRefundReason() {
  159. commonRefundReason().then((res) => {
  160. if (res.code === 1) {
  161. this.refund_reason = res.data
  162. }
  163. })
  164. },
  165. openPop() {
  166. this.$refs.popup.open()
  167. },
  168. popOn() {
  169. this.$refs.popup.close()
  170. },
  171. blur() {
  172. if (this.fromData.number >= (Number(this.goods_info.goods_number) - Number(this.goods_info.finish_number) - Number(this.goods_info.refund_number))) {
  173. tools.error('退款数量最大为' + (Number(this.goods_info.goods_number) - Number(this.goods_info.finish_number) - Number(this.goods_info.refund_number)))
  174. this.fromData.number = (Number(this.goods_info.goods_number) - Number(this.goods_info.finish_number) - Number(this.goods_info.refund_number))
  175. } else if (this.fromData.number <= 0) {
  176. tools.error('退款数量最少为1')
  177. this.fromData.number = 1
  178. }
  179. },
  180. setNum(num) {
  181. if (num === 1) {
  182. // 减
  183. if (this.fromData.number <= 1) {
  184. tools.error('退款数量最少为1')
  185. return
  186. }
  187. --this.fromData.number
  188. } else {
  189. // 加
  190. if (this.fromData.number >= (Number(this.goods_info.goods_number) - Number(this.goods_info.finish_number) - Number(this.goods_info.refund_number))) {
  191. tools.error('退款数量已是最大值')
  192. return
  193. }
  194. ++this.fromData.number
  195. }
  196. },
  197. scrolltolower() {
  198. console.log('触底');
  199. },
  200. groupOrderInfo() {
  201. groupOrderInfo({
  202. order_id: this.fromData.order_id
  203. }).then((res) => {
  204. if (res.code === 1) {
  205. this.goods_info = res.data
  206. }
  207. })
  208. }
  209. },
  210. }
  211. </script>
  212. <style lang="scss" scoped>
  213. .pop-b {
  214. height: 60rpx;
  215. line-height: 60rpx;
  216. }
  217. .pop-box {
  218. max-height: 60vh;
  219. border-radius: 20rpx 20rpx 0 0;
  220. position: relative;
  221. }
  222. .pop-gb {
  223. position: absolute;
  224. right: 24rpx;
  225. top: 24rpx;
  226. }
  227. .but {
  228. width: 40%;
  229. height: 80rpx;
  230. line-height: 80rpx;
  231. }
  232. .goods-img {
  233. width: 80rpx;
  234. height: 80rpx;
  235. border-radius: 20rpx;
  236. }
  237. .j {
  238. width: 40rpx;
  239. height: 40rpx;
  240. }
  241. .input {
  242. max-width: 50rpx;
  243. margin: 0 10rpx;
  244. text-align: center;
  245. }
  246. </style>