index.vue 7.5 KB

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