orderAfterSales.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view>
  3. <view class="flex-col">
  4. <view class="myclient_list flex-col">
  5. <view class="flex-row justify-between">
  6. <view class="nl ">
  7. {{form.mainTitle}}
  8. </view>
  9. <!-- <view class="success_status ">{{form.orderStateDesc}}</view>-->
  10. </view>
  11. <view class="flex-col">
  12. <view class="phone">
  13. <image referrerpolicy="no-referrer" src="http://www.gzzzyd.com/groupon/home_slices/日期@2x.png" />
  14. <text>
  15. 团购日期: {{form.grouponStartTime}} 至 {{form.grouponEndTime}}
  16. </text>
  17. </view>
  18. <view class="time">
  19. <image referrerpolicy="no-referrer"
  20. src="http://www.gzzzyd.com/groupon/home_slices/出厂编号-线@2x.png" />
  21. <text>
  22. 订单编号: {{form.orderNo}}
  23. </text>
  24. </view>
  25. </view>
  26. <view class=" vgoodsNumber flex-row justify-center">
  27. <text>请选择退货的商品和数量</text>
  28. </view>
  29. </view>
  30. <view class="conter " :style="{'height':height}">
  31. <scroll-view :scroll-top="scrollTop" scroll-y="true" :style="{'height':height}">
  32. <view>
  33. <view class="all-products-body flex-row" v-for="(item,i) in form.goodsList" :key="i">
  34. <view class="flex-col justify-center" v-if="item.isAfterSales == 0">
  35. <view v-if="item.isVGoods" class="image-view" @click="vGoods(item)">
  36. <image class="image" src="/static/images/v.png"></image>
  37. </view>
  38. <view v-else class="image-view @click=" @click="vGoods(item)">
  39. <image class="image" src="/static/images/o.png"></image>
  40. </view>
  41. </view>
  42. <view class="all-products-item flex-row " v-if="item.isAfterSales == 0">
  43. <image class="goodsImage " :src="item.goodsImage" mode="scaleToFill" />
  44. <view class="all-products-item-content flex-col">
  45. <view class="all-products-item-content-t ">
  46. {{item.goodsName}}
  47. </view>
  48. <view class="all-products-item-content-b flex-row justify-between ">
  49. <view class="flex-row">
  50. <text class="red">{{item.goodsPrice}}</text>
  51. <!-- <text class="line-thr">{{item.goodsName}}</text> -->
  52. </view>
  53. <view class=" number-box">
  54. <u-number-box :min=0 :max="formCopy.goodsList[i].goodsNum"
  55. v-model="item.goodsNum"> </u-number-box>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </scroll-view>
  63. </view>
  64. <view class="bottom">
  65. <view class=" button-view flex-row " v-if="type == 2">
  66. <text class="reason">退货原因:</text>
  67. <view class="input-view flex-col justify-center" @click="openRefundShow">
  68. <view>
  69. <u-input disabled placeholder="请选择退货原因" v-model="reason"></u-input>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="button-view flex-col justify-center ">
  74. <u-button color="#B42A3E " @click="refundSubmit" v-if="type == 1">提交</u-button>
  75. <u-button color="#B42A3E " @click="afterSalesSubmit" v-if="type == 2">提交</u-button>
  76. </view>
  77. </view>
  78. </view>
  79. <u-popup :show="RefundShow" @close="RefundShow = false" @open=" ">
  80. <view class="Refund_view">
  81. <view class="Refund_view_title">请选择退货/退款原因</view>
  82. <view class="">
  83. <scroll-view :scroll-top="scrollTop" scroll-y="true" :style="{'height':'400rpx'}">
  84. <u-radio-group v-model="reason" placement="column">
  85. <u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in reasonList"
  86. :key="index" :label="item.reason" :name="item.reason">
  87. </u-radio>
  88. </u-radio-group>
  89. </scroll-view>
  90. </view>
  91. <button class="Refund_view_btn" @click="RefundShow = false">
  92. 确定
  93. </button>
  94. </view>
  95. </u-popup>
  96. </view>
  97. </template>
  98. <script>
  99. import {
  100. reasonList,
  101. afterSalesSubmit,
  102. refundSubmit
  103. } from '@/api/groupon.js';
  104. import UInput from "../../../uni_modules/uview-ui/components/u-input/u-input";
  105. export default {
  106. components: {
  107. UInput
  108. },
  109. data() {
  110. return {
  111. reason: '',
  112. goodsIds: [],
  113. reasonList: [],
  114. form: {},
  115. formCopy: {},
  116. RefundShow: false,
  117. height: '',
  118. type: 0,
  119. }
  120. },
  121. onLoad(e) {
  122. this.form = JSON.parse(decodeURIComponent(e.item));
  123. this.type = e.type;
  124. this.formCopy = JSON.parse(decodeURIComponent(e.item));
  125. console.log(this.form)
  126. },
  127. onShow() {
  128. let sysInfo = uni.getSystemInfoSync();
  129. this.height = sysInfo.windowHeight - (sysInfo.screenWidth / 750) * (500) + 'px';
  130. console.log(this.height)
  131. },
  132. methods: {
  133. refundSubmit() {
  134. if (this.goodsIds.length <= 0) {
  135. uni.$u.toast('请选择商品')
  136. return
  137. }
  138. let flag = false
  139. let afterSalesGoods = []
  140. this.form.goodsList.forEach(item => {
  141. if (this.goodsIds.indexOf(item.id) !== -1) {
  142. if (!item.goodsNum) {
  143. uni.$u.toast('请选择商品数量')
  144. flag = true
  145. }
  146. afterSalesGoods.push(item)
  147. }
  148. })
  149. if (flag) {
  150. return;
  151. }
  152. let params = {
  153. orderId: this.form.orderId,
  154. afterSalesGoodsList: afterSalesGoods
  155. };
  156. refundSubmit(params).then(res => {
  157. console.log("refundSubmit...")
  158. // uni.$u.toast(res.msg)
  159. uni.navigateBack();
  160. }).catch(err => {
  161. uni.$u.toast(err.msg)
  162. })
  163. },
  164. afterSalesSubmit() {
  165. if (this.goodsIds.length <= 0) {
  166. uni.$u.toast('请选择商品')
  167. return
  168. }
  169. if (!this.reason) {
  170. uni.$u.toast('请选择原因')
  171. return
  172. }
  173. let flag = false
  174. let afterSalesGoods = []
  175. this.form.goodsList.forEach(item => {
  176. if (this.goodsIds.indexOf(item.id) !== -1) {
  177. if (!item.goodsNum) {
  178. uni.$u.toast('请选择商品数量')
  179. flag = true
  180. }
  181. afterSalesGoods.push(item)
  182. }
  183. })
  184. if (flag) {
  185. return;
  186. }
  187. let params = {
  188. reason: this.reason,
  189. orderId: this.form.orderId,
  190. afterSalesGoodsList: afterSalesGoods
  191. };
  192. afterSalesSubmit(params).then(res => {
  193. // uni.$u.toast(res.msg)
  194. uni.navigateBack();
  195. }).catch(err => {
  196. uni.$u.toast(err.msg)
  197. })
  198. },
  199. vGoods(item, index) {
  200. item.isVGoods = !item.isVGoods;
  201. this.$set(this.form.goodsList, index, item)
  202. if (this.goodsIds.indexOf(item.id) === -1) {
  203. this.goodsIds.push(item.id)
  204. } else {
  205. this.goodsIds = this.goodsIds.filter(iter => iter !== item.id)
  206. }
  207. },
  208. openRefundShow() {
  209. this.RefundShow = true
  210. reasonList().then(res => {
  211. this.reasonList = res.data
  212. console.log(this.reasonList)
  213. })
  214. },
  215. }
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. @import "/static/css/common.css";
  220. @import './index.rpx.css';
  221. </style>