index.vue 7.8 KB

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