index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <view :style="colorStyle">
  3. <form @submit="subRefund">
  4. <view class='apply-return'>
  5. <view class='goodsStyle acea-row row-between' v-for="(item,index) in refundCartInfo" :key="index">
  6. <view class='pictrue'>
  7. <image :src='item.productInfo.attrInfo?item.productInfo.attrInfo.image:item.productInfo.image'></image>
  8. </view>
  9. <view class='text acea-row row-between'>
  10. <view class='name line2'>{{item.productInfo.store_name}}</view>
  11. <view class='money'>
  12. <view>¥{{item.truePrice}}</view>
  13. <view class='num'>x{{item.cart_num}}</view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class='list'>
  18. <view class='item acea-row row-between-wrapper'>
  19. <view>退货条款</view>
  20. <navigator url="/pages/new/outOrder">
  21. <view class='num' style="color: cornflowerblue;">
  22. 查看详情
  23. </view>
  24. </navigator>
  25. </view>
  26. <view class='item acea-row row-between-wrapper'>
  27. <view>退货件数</view>
  28. <view class='num' v-if="refundCartInfo.length !== 1 || refund_total_num == 1">
  29. {{refund_total_num}}
  30. </view>
  31. <picker v-else class='num' @change="returnGoodsNum" :value="refund_num_index" :range="refundNumData">
  32. <view class="picker acea-row row-between-wrapper">
  33. <view class='reason'>{{refundNumData[refund_num_index]}}</view>
  34. <text class='iconfont icon-jiantou'></text>
  35. </view>
  36. </picker>
  37. <!-- <input type="number" v-model="refund_num" @input="inputNumber" v-else /> -->
  38. </view>
  39. <!-- <view class='item acea-row row-between-wrapper'>
  40. <view>退款金额</view>
  41. <view class='num' v-if="refundCartInfo.length !== 1">¥{{refund_pay_price.toFixed(2)}}</view>
  42. <view class='num' v-else>¥{{refund_Money.toFixed(2)}}
  43. </view>
  44. </view> -->
  45. <view class='item acea-row row-between-wrapper'
  46. v-if="status && status._type !== 1 && !productType">
  47. <view>退款类型</view>
  48. <picker class='num' @change="returnGoodsChange" :value="returnGoods" :range="returnGoodsData">
  49. <view class="picker acea-row row-between-wrapper">
  50. <view class='reason'>{{returnGoodsData[returnGoods]}}</view>
  51. <text class='iconfont icon-jiantou'></text>
  52. </view>
  53. </picker>
  54. </view>
  55. <view class='item acea-row row-between-wrapper'>
  56. <view>退款原因</view>
  57. <picker class='num' @change="bindPickerChange" :value="index" :range="RefundArray">
  58. <view class="picker acea-row row-between-wrapper">
  59. <view class='reason'>{{RefundArray[index]}}</view>
  60. <text class='iconfont icon-jiantou'></text>
  61. </view>
  62. </picker>
  63. </view>
  64. <view class='item textarea acea-row row-between'>
  65. <view>备注说明</view>
  66. <textarea placeholder='填写备注信息,100字以内' class='num' name="refund_reason_wap_explain"
  67. placeholder-class='填写备注信息,100字以内'></textarea>
  68. </view>
  69. <view class='item acea-row row-between'>
  70. <view class='title acea-row row-between-wrapper'>
  71. <view>上传凭证</view>
  72. <view class='tip'>( 最多可上传3张 )</view>
  73. </view>
  74. <view class='upload acea-row row-middle'>
  75. <view class='pictrue' v-for="(item,index) in refund_reason_wap_img" :key="index">
  76. <image :src='item'></image>
  77. <view class='iconfont icon-guanbi1 font-num' @tap='DelPic(index)'></view>
  78. </view>
  79. <view class='pictrue acea-row row-center-wrapper row-column' @tap='uploadpic'
  80. v-if="refund_reason_wap_img.length < 3">
  81. <text class='iconfont icon-icon25201'></text>
  82. <view>上传凭证</view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <button :disabled="buttonDisabled" class='returnBnt bg-color' form-type="submit">申请退款</button>
  88. </view>
  89. </form>
  90. <!-- #ifdef MP -->
  91. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  92. <!-- #endif -->
  93. </view>
  94. </template>
  95. <script>
  96. import {
  97. ordeRefundReason,
  98. orderRefundVerify,
  99. getOrderDetail,
  100. returnGoodsSubmit,
  101. postRefundGoods
  102. } from '@/api/order.js';
  103. import {
  104. toLogin
  105. } from '@/libs/login.js';
  106. import {
  107. mapGetters
  108. } from "vuex";
  109. import colors from '@/mixins/color.js';
  110. export default {
  111. components: {},
  112. mixins: [colors],
  113. data() {
  114. return {
  115. id:0,
  116. cartIds:[],
  117. refund_reason_wap_img: [],
  118. status: {},
  119. RefundArray: [],
  120. refundCartInfo: [],
  121. returnGoodsData: ['仅退款', '退货并退款'],
  122. refund_total_num: 0,
  123. index: 0,
  124. returnGoods: 0,
  125. orderId: 0,
  126. refundNumData: [],
  127. refund_num_index: 0,
  128. productType:0,
  129. isShowAuth: false,
  130. buttonDisabled: false
  131. };
  132. },
  133. computed: mapGetters(['isLogin']),
  134. watch: {
  135. isLogin: {
  136. handler: function(newV, oldV) {
  137. if (newV) {
  138. this.refundGoodsInfo();
  139. this.getRefundReason();
  140. }
  141. },
  142. deep: true
  143. }
  144. },
  145. onLoad(options) {
  146. this.orderId = options.orderId;
  147. this.id = options.id;
  148. this.productType = parseInt(options.productType) || 0;
  149. if(options.cartIds){
  150. this.cartIds = JSON.parse(options.cartIds) || []
  151. }
  152. if (this.isLogin) {
  153. this.refundGoodsInfo();
  154. this.getRefundReason();
  155. } else {
  156. toLogin();
  157. }
  158. },
  159. onShow() {
  160. uni.removeStorageSync('form_type_cart');
  161. },
  162. methods: {
  163. onLoadFun(){
  164. this.refundGoodsInfo();
  165. this.getRefundReason();
  166. this.isShowAuth = false
  167. },
  168. // 授权关闭
  169. authColse: function(e) {
  170. this.isShowAuth = e
  171. },
  172. refundGoodsInfo(){
  173. postRefundGoods({id:this.id,cart_ids:this.cartIds}).then(res=>{
  174. let data = res.data;
  175. this.status = data._status;
  176. this.refundCartInfo = data.cartInfo;
  177. this.refundCartInfo.forEach(item=>{
  178. this.refund_total_num = this.$util.$h.Add(this.refund_total_num, item.cart_num)
  179. })
  180. this.refundNumData = Array(this.refund_total_num).fill(0).map((e, i) => i + 1)
  181. }).catch(err=>{
  182. return this.$util.Tips({
  183. title: err
  184. });
  185. })
  186. },
  187. /**
  188. * 获取退款理由
  189. */
  190. getRefundReason: function() {
  191. let that = this;
  192. ordeRefundReason().then(res => {
  193. that.$set(that, 'RefundArray', res.data);
  194. })
  195. },
  196. /**
  197. * 删除图片
  198. *
  199. */
  200. DelPic: function(e) {
  201. let index = e,
  202. that = this,
  203. pic = this.refund_reason_wap_img[index];
  204. that.refund_reason_wap_img.splice(index, 1);
  205. that.$set(that, 'refund_reason_wap_img', that.refund_reason_wap_img);
  206. },
  207. /**
  208. * 上传文件
  209. *
  210. */
  211. uploadpic: function() {
  212. let that = this;
  213. this.$util.uploadImageOne('upload/image', function(res) {
  214. that.refund_reason_wap_img.push(res.data.url);
  215. that.$set(that, 'refund_reason_wap_img', that.refund_reason_wap_img);
  216. });
  217. },
  218. /**
  219. * 申请退货
  220. */
  221. subRefund: function(e) {
  222. this.buttonDisabled = true;
  223. let that = this,
  224. value = e.detail.value;
  225. //收集form表单
  226. if (!value.refund_reason_wap_explain) {
  227. this.buttonDisabled = false;
  228. return this.$util.Tips({
  229. title: '请输入备注说明'
  230. });
  231. }
  232. let cartInfo = this.refundCartInfo;
  233. if(cartInfo.length === 1){
  234. this.cartIds = [
  235. {
  236. cart_id:cartInfo[0].id,
  237. cart_num: this.refund_num_index + 1
  238. }
  239. ]
  240. }
  241. returnGoodsSubmit(this.id, {
  242. text: that.RefundArray[that.index] || '',
  243. refund_reason_wap_explain: value.refund_reason_wap_explain,
  244. refund_reason_wap_img: that.refund_reason_wap_img.join(','),
  245. refund_type: this.returnGoods ? 2 : 1,
  246. uni: that.orderId,
  247. cart_ids: this.cartIds
  248. }).then(res => {
  249. this.buttonDisabled = false;
  250. return this.$util.Tips({
  251. title: '申请成功',
  252. icon: 'success'
  253. }, {
  254. tab: 5,
  255. url: '/pages/users/user_return_list/index?isT=1'
  256. });
  257. }).catch(err => {
  258. this.buttonDisabled = false;
  259. return this.$util.Tips({
  260. title: err
  261. });
  262. })
  263. },
  264. bindPickerChange(e) {
  265. this.$set(this, 'index', e.detail.value);
  266. },
  267. returnGoodsChange(e) {
  268. this.$set(this, 'returnGoods', e.detail.value);
  269. },
  270. returnGoodsNum(e) {
  271. this.$set(this, 'refund_num_index', Number(e.detail.value));
  272. }
  273. }
  274. }
  275. </script>
  276. <style scoped lang="scss">
  277. .apply-return .list {
  278. background-color: #fff;
  279. margin-top: 18rpx;
  280. }
  281. .apply-return .list .item {
  282. margin-left: 30rpx;
  283. padding-right: 30rpx;
  284. min-height: 90rpx;
  285. border-bottom: 1rpx solid #eee;
  286. font-size: 30rpx;
  287. color: #333;
  288. }
  289. .apply-return .list .item .num {
  290. color: #282828;
  291. width: 427rpx;
  292. text-align: right;
  293. }
  294. .apply-return .list .item .num .picker .reason {
  295. width: 385rpx;
  296. }
  297. .apply-return .list .item .num .picker .iconfont {
  298. color: #666;
  299. font-size: 30rpx;
  300. margin-top: 2rpx;
  301. }
  302. .apply-return .list .item.textarea {
  303. padding: 30rpx 30rpx 30rpx 0;
  304. }
  305. .apply-return .list .item textarea {
  306. height: 100rpx;
  307. font-size: 30rpx;
  308. }
  309. .apply-return .list .item .placeholder {
  310. color: #bbb;
  311. }
  312. .apply-return .list .item .title {
  313. height: 95rpx;
  314. width: 100%;
  315. }
  316. .apply-return .list .item .title .tip {
  317. font-size: 30rpx;
  318. color: #bbb;
  319. }
  320. .apply-return .list .item .upload {
  321. padding-bottom: 36rpx;
  322. }
  323. .apply-return .list .item .upload .pictrue {
  324. margin: 22rpx 23rpx 0 0;
  325. width: 156rpx;
  326. height: 156rpx;
  327. position: relative;
  328. font-size: 24rpx;
  329. color: #bbb;
  330. }
  331. .apply-return .list .item .upload .pictrue:nth-of-type(4n) {
  332. margin-right: 0;
  333. }
  334. .apply-return .list .item .upload .pictrue image {
  335. width: 100%;
  336. height: 100%;
  337. border-radius: 3rpx;
  338. }
  339. .apply-return .list .item .upload .pictrue .icon-guanbi1 {
  340. position: absolute;
  341. font-size: 45rpx;
  342. top: -10rpx;
  343. right: -10rpx;
  344. }
  345. .apply-return .list .item .upload .pictrue .icon-icon25201 {
  346. color: #bfbfbf;
  347. font-size: 50rpx;
  348. }
  349. .apply-return .list .item .upload .pictrue:nth-last-child(1) {
  350. border: 1rpx solid #ddd;
  351. box-sizing: border-box;
  352. }
  353. .apply-return .returnBnt {
  354. font-size: 32rpx;
  355. color: #fff;
  356. width: 690rpx;
  357. height: 86rpx;
  358. border-radius: 50rpx;
  359. text-align: center;
  360. line-height: 86rpx;
  361. margin: 43rpx auto;
  362. }
  363. .goodsStyle .text .name {
  364. align-self: flex-start;
  365. }
  366. .list /deep/ .uni-input-input {
  367. text-align: right;
  368. }
  369. </style>