index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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 orderInfo.cart_info" :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>{{$t(`¥`)}}{{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' v-if="expressList.length">
  19. <view>{{$t(`快递公司`)}}</view>
  20. <picker class='num' @change="bindPickerChange" :value="seIndex" :range="expressList" range-key="name">
  21. <view class="picker acea-row row-between-wrapper">
  22. <view class='reason'>{{expressList[seIndex].name}}</view>
  23. <text class='iconfont icon-jiantou'></text>
  24. </view>
  25. </picker>
  26. </view>
  27. <view class='item acea-row row-between-wrapper'>
  28. <view>{{$t(`快递单号`)}}</view>
  29. <input type="text" :placeholder="$t(`填写快递单号`)" placeholder-class='placeholder' v-model="refundInfo.refund_express" />
  30. </view>
  31. <view class='item acea-row row-between-wrapper'>
  32. <view>{{$t(`联系电话`)}}</view>
  33. <input type="number" :placeholder="$t(`请输入手机号`)" placeholder-class='placeholder' v-model="refundInfo.refund_phone" />
  34. </view>
  35. <view class='item textarea acea-row row-between'>
  36. <view>{{$t(`备注说明`)}}</view>
  37. <textarea :placeholder='$t(`填写备注信息,100字以内`)' class='num' v-model="refundInfo.refund_explain"></textarea>
  38. </view>
  39. <view class='item acea-row row-between'>
  40. <view class='title acea-row row-between-wrapper'>
  41. <view>{{$t(`上传图片`)}}</view>
  42. <view class='tip'>{{$t(`最多可上传3张`)}}</view>
  43. </view>
  44. <view class='upload acea-row row-middle'>
  45. <view class='pictrue' v-for="(item,index) in refund_reason_wap_img" :key="index">
  46. <image :src='item'></image>
  47. <view class='iconfont icon-guanbi1 font-num' @tap='DelPic(index)'></view>
  48. </view>
  49. <view class='pictrue acea-row row-center-wrapper row-column' @tap='uploadpic'
  50. v-if="refund_reason_wap_img.length < 3">
  51. <text class='iconfont icon-icon25201'></text>
  52. <view>{{$t(`上传图片`)}}</view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <button class='returnBnt bg-color' form-type="submit">{{$t(`提交`)}}</button>
  58. </view>
  59. </form>
  60. </view>
  61. </template>
  62. <script>
  63. import { refundOrderDetail, refundExpress } from '@/api/order.js';
  64. import {
  65. toLogin
  66. } from '@/libs/login.js';
  67. import {
  68. mapGetters
  69. } from "vuex";
  70. import colors from '@/mixins/color.js';
  71. export default {
  72. mixins: [colors],
  73. data() {
  74. return {
  75. expressList:[],
  76. orderInfo:{},
  77. seIndex: 0,
  78. refund_reason_wap_img: [],
  79. refundInfo:{
  80. refund_express:'',
  81. refund_phone:'',
  82. refund_explain:'',
  83. id:'',
  84. refund_express_name:'',
  85. refund_img:''
  86. }
  87. };
  88. },
  89. computed: mapGetters(['isLogin']),
  90. watch: {
  91. isLogin: {
  92. handler: function(newV, oldV) {
  93. if (newV) {
  94. this.getOrderInfo();
  95. }
  96. },
  97. deep: true
  98. }
  99. },
  100. onLoad(options) {
  101. this.orderId = options.orderId;
  102. if (this.isLogin) {
  103. this.getOrderInfo();
  104. } else {
  105. toLogin();
  106. }
  107. },
  108. methods: {
  109. /**
  110. * 申请退货
  111. */
  112. subRefund: function(e) {
  113. let that = this
  114. if (!that.refundInfo.refund_express) return this.$util.Tips({
  115. title: that.$t(`填写快递单号`)
  116. });
  117. if (!that.refundInfo.refund_phone) return this.$util.Tips({
  118. title: that.$t(`请输入手机号`)
  119. });
  120. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.refundInfo.refund_phone)) return this.$util.Tips({
  121. title: that.$t(`请输入正确的手机号码`)
  122. });
  123. that.refundInfo.refund_express_name = that.expressList[that.seIndex].name;
  124. that.refundInfo.refund_img = that.refund_reason_wap_img.join(',');
  125. refundExpress(that.refundInfo).then(res => {
  126. return this.$util.Tips({
  127. title: res.msg,
  128. icon: 'success'
  129. }, {
  130. tab: 5,
  131. url: '/pages/users/user_return_list/index?isT=1'
  132. });
  133. }).catch(err => {
  134. return this.$util.Tips({
  135. title: err
  136. });
  137. })
  138. },
  139. /**
  140. * 删除图片
  141. *
  142. */
  143. DelPic: function(e) {
  144. let index = e,
  145. that = this,
  146. pic = this.refund_reason_wap_img[index];
  147. that.refund_reason_wap_img.splice(index, 1);
  148. that.$set(that, 'refund_reason_wap_img', that.refund_reason_wap_img);
  149. },
  150. /**
  151. * 上传文件
  152. *
  153. */
  154. uploadpic: function() {
  155. let that = this;
  156. this.$util.uploadImageOne('upload/image', function(res) {
  157. that.refund_reason_wap_img.push(res.data.url);
  158. that.$set(that, 'refund_reason_wap_img', that.refund_reason_wap_img);
  159. });
  160. },
  161. /**
  162. * 获取订单详情
  163. *
  164. */
  165. getOrderInfo: function() {
  166. let that = this;
  167. refundOrderDetail(that.orderId).then(res => {
  168. that.$set(that, 'orderInfo', res.data);
  169. that.expressList = res.data.express_list;
  170. that.refundInfo.id = res.data.id;
  171. });
  172. },
  173. bindPickerChange(e) {
  174. this.$set(this, 'seIndex', e.detail.value);
  175. }
  176. }
  177. }
  178. </script>
  179. <style scoped lang="scss">
  180. .apply-return .list {
  181. background-color: #fff;
  182. margin-top: 18rpx;
  183. }
  184. .apply-return .list .item {
  185. margin-left: 30rpx;
  186. padding-right: 30rpx;
  187. min-height: 90rpx;
  188. border-bottom: 1rpx solid #eee;
  189. font-size: 30rpx;
  190. color: #333;
  191. }
  192. .apply-return .list .item .num {
  193. color: #282828;
  194. width: 427rpx;
  195. text-align: right;
  196. }
  197. .apply-return .list .item .num .picker .reason {
  198. width: 385rpx;
  199. }
  200. .apply-return .list .item .num .picker .iconfont {
  201. color: #666;
  202. font-size: 30rpx;
  203. margin-top: 2rpx;
  204. }
  205. .apply-return .list .item.textarea {
  206. padding: 30rpx 30rpx 30rpx 0;
  207. }
  208. .apply-return .list .item textarea {
  209. height: 100rpx;
  210. font-size: 30rpx;
  211. }
  212. .apply-return .list .item .placeholder {
  213. color: #bbb;
  214. font-size: 30rpx;
  215. text-align: right;
  216. }
  217. .apply-return .list .item .title {
  218. height: 95rpx;
  219. width: 100%;
  220. }
  221. .apply-return .list .item .title .tip {
  222. font-size: 30rpx;
  223. color: #bbb;
  224. }
  225. .apply-return .list .item .upload {
  226. padding-bottom: 36rpx;
  227. }
  228. .apply-return .list .item .upload .pictrue {
  229. margin: 22rpx 23rpx 0 0;
  230. width: 156rpx;
  231. height: 156rpx;
  232. position: relative;
  233. font-size: 24rpx;
  234. color: #bbb;
  235. }
  236. .apply-return .list .item .upload .pictrue:nth-of-type(4n) {
  237. margin-right: 0;
  238. }
  239. .apply-return .list .item .upload .pictrue image {
  240. width: 100%;
  241. height: 100%;
  242. border-radius: 3rpx;
  243. }
  244. .apply-return .list .item .upload .pictrue .icon-guanbi1 {
  245. position: absolute;
  246. font-size: 45rpx;
  247. top: -10rpx;
  248. right: -10rpx;
  249. }
  250. .apply-return .list .item .upload .pictrue .icon-icon25201 {
  251. color: #bfbfbf;
  252. font-size: 50rpx;
  253. }
  254. .apply-return .list .item .upload .pictrue:nth-last-child(1) {
  255. border: 1rpx solid #ddd;
  256. box-sizing: border-box;
  257. }
  258. .apply-return .returnBnt {
  259. font-size: 32rpx;
  260. color: #fff;
  261. width: 690rpx;
  262. height: 86rpx;
  263. border-radius: 50rpx;
  264. text-align: center;
  265. line-height: 86rpx;
  266. margin: 43rpx auto;
  267. }
  268. .goodsStyle .text .name {
  269. align-self: flex-start;
  270. }
  271. .list /deep/ .uni-input-input {
  272. text-align: right;
  273. }
  274. </style>