index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <view class="refund-wrapper" :style="viewColor">
  3. <view class="item" v-for="(item,index) in productData" :key="index">
  4. <view class="img-box">
  5. <image :src="item.product.cart_info.product.image"></image>
  6. </view>
  7. <view class="info">
  8. <view class="name line1">{{item.product.cart_info.product.store_name}}</view>
  9. <view class="price" style="color: #868686;">{{item.product.cart_info.productAttr.sku}}</view>
  10. </view>
  11. </view>
  12. <view class="form-box">
  13. <view class="form-item item-txt">
  14. <text class="label">物流公司</text>
  15. <view class="picker" v-if="numArray.length>0">
  16. <picker @change="bindNumChange" :value="numIndex" :range="numArray" range-key="label">
  17. <view class="picker-box">
  18. {{numArray[numIndex]['label']}}
  19. <text class="iconfont icon-jiantou"></text>
  20. </view>
  21. </picker>
  22. </view>
  23. </view>
  24. <view class="form-item item-txt">
  25. <text class="label">物流单号</text>
  26. <input style="text-align: right;" type="text" placeholder="请输入物流单号" v-model="number">
  27. </view>
  28. <view class="form-item item-txt">
  29. <text class="label">联系电话</text>
  30. <input style="text-align: right;" type="text" placeholder="请输入电话" v-model="phone">
  31. </view>
  32. </view>
  33. <view class="btn-box" @click="bindComfirm">提交</view>
  34. <alertBox :msg="msg" v-if="isShowBox" @bindClose="bindClose"></alertBox>
  35. </view>
  36. </template>
  37. <script>
  38. // +----------------------------------------------------------------------
  39. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  40. // +----------------------------------------------------------------------
  41. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  42. // +----------------------------------------------------------------------
  43. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  44. // +----------------------------------------------------------------------
  45. // | Author: CRMEB Team <admin@crmeb.com>
  46. // +----------------------------------------------------------------------
  47. import {refundDetail,expressList,refundBackGoods } from '@/api/order.js'
  48. import { checkPhone } from '@/utils/validate.js'
  49. import alertBox from '@/components/alert/index.vue'
  50. import { mapGetters } from "vuex";
  51. export default{
  52. components:{
  53. alertBox
  54. },
  55. data(){
  56. return {
  57. order_id:0,
  58. isShowBox:false,
  59. // 图片上传
  60. uploadImg:[],
  61. numArray:[],
  62. numIndex:0,
  63. //订单id
  64. id:'',
  65. productData:[],
  66. con:'',
  67. refund_price:'',
  68. msg:'',
  69. // 快递单号
  70. number:'',
  71. phone:''
  72. }
  73. },
  74. computed: {
  75. ...mapGetters(['viewColor'])
  76. },
  77. onLoad(optios) {
  78. this.id = optios.id
  79. this.refund_type = optios.refund_type
  80. this.type = optios.type,
  81. this.order_id = optios.order_id
  82. Promise.all([this.refundProduct(),this.expressList()])
  83. },
  84. methods:{
  85. // 退款理由
  86. expressList(){
  87. expressList().then(res=>{
  88. this.numArray = res.data
  89. })
  90. },
  91. // 退款商品
  92. refundProduct(){
  93. refundDetail(this.id).then(({data})=>{
  94. this.productData = data.refundProduct
  95. })
  96. },
  97. // 下拉选中
  98. bindPickerChange(e){
  99. this.qsIndex = e.target.value
  100. },
  101. bindNumChange(e){
  102. this.numIndex = e.target.value
  103. this.refund_price = this.unitPrice*this.numArray[e.target.value]
  104. },
  105. // 删除图片
  106. deleteImg(index){
  107. this.uploadImg.splice(index,1)
  108. },
  109. /**
  110. * 上传文件
  111. */
  112. uploadpic: function () {
  113. if(this.uploadImg.length <9){
  114. let that = this;
  115. that.$util.uploadImageOne('upload/image', function (res) {
  116. that.uploadImg.push(res.data.path);
  117. that.$set(that,'uploadImg',that.uploadImg);
  118. });
  119. }else{
  120. uni.showToast({
  121. title:'最多可上传9张',
  122. icon:'none'
  123. })
  124. }
  125. },
  126. // 提交
  127. async bindComfirm(){
  128. try {
  129. if(!this.number){
  130. uni.showToast({
  131. title:'请填写快递单号',
  132. icon:'none'
  133. })
  134. return
  135. }
  136. if(!checkPhone(this.phone)){
  137. uni.showToast({
  138. title:'请填写正确的手机号码',
  139. icon:'none'
  140. })
  141. return
  142. }
  143. const data = await refundBackGoods(this.id,{
  144. delivery_type:this.numArray[this.numIndex].label,
  145. delivery_id:this.number,
  146. delivery_phone:this.phone,
  147. ids:this.ids,
  148. delivery_mark:this.con,
  149. delivery_pics:this.uploadImg
  150. })
  151. this.msg = data.message
  152. this.isShowBox = true
  153. }catch(err){
  154. uni.showToast({
  155. title:err,
  156. icon:'none'
  157. })
  158. }
  159. },
  160. // 弹窗关闭
  161. bindClose(){
  162. this.isShowBox = false
  163. uni.redirectTo({
  164. url:'/pages/users/refund/detail?id='+this.id
  165. })
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss">
  171. .refund-wrapper{
  172. .item{
  173. position: relative;
  174. display: flex;
  175. padding: 25rpx 30rpx;
  176. background-color: #fff;
  177. &:after{
  178. content: ' ';
  179. position: absolute;
  180. right: 0;
  181. bottom: 0;
  182. width: 657rpx;
  183. height: 1px;
  184. background: #F0F0F0;
  185. }
  186. .img-box{
  187. width: 130rpx;
  188. height: 130rpx;
  189. image{
  190. width: 130rpx;
  191. height: 130rpx;
  192. border-radius:16rpx;
  193. }
  194. }
  195. .info{
  196. display: flex;
  197. flex-direction: column;
  198. width: 440rpx;
  199. margin-left: 26rpx;
  200. .tips{
  201. color: #868686;
  202. font-size: 20rpx;
  203. }
  204. .price{
  205. margin-top: 15rpx;
  206. font-size: 26rpx;
  207. }
  208. }
  209. .check-box{
  210. display: flex;
  211. align-items: center;
  212. justify-content: center;
  213. flex: 1;
  214. .iconfont{
  215. font-size: 40rpx;
  216. color: #CCCCCC;
  217. }
  218. .icon-xuanzhong1{
  219. color: $theme-color;
  220. }
  221. }
  222. }
  223. .form-box{
  224. padding-left: 30rpx;
  225. margin-top: 18rpx;
  226. background-color: #fff;
  227. .form-item{
  228. display: flex;
  229. justify-content: space-between;
  230. border-bottom: 1px solid #f0f0f0;
  231. font-size: 30rpx;
  232. }
  233. .item-txt{
  234. align-items: center;
  235. width: 100%;
  236. padding:30rpx 30rpx 30rpx 0;
  237. }
  238. .item-txtarea{
  239. padding:30rpx 30rpx 30rpx 0;
  240. textarea{
  241. display: block;
  242. width: 400rpx;
  243. height: 100rpx;
  244. font-size: 30rpx;
  245. text-align: right;
  246. }
  247. }
  248. .icon-jiantou{
  249. margin-left: 10rpx;
  250. font-size: 28rpx;
  251. color: #BBBBBB;
  252. }
  253. }
  254. .upload-box{
  255. padding: 30rpx;
  256. background-color: #fff;
  257. .title{
  258. display: flex;
  259. align-items: center;
  260. justify-content: space-between;
  261. font-size: 30rpx;
  262. .des{
  263. color: #BBBBBB;
  264. }
  265. }
  266. .upload-img{
  267. display: flex;
  268. flex-wrap: wrap;
  269. margin-top: 20rpx;
  270. .img-item{
  271. position: relative;
  272. width: 156rpx;
  273. height: 156rpx;
  274. margin-right: 24rpx;
  275. margin-top: 20rpx;
  276. image{
  277. width: 156rpx;
  278. height: 156rpx;
  279. border-radius: 8rpx;
  280. }
  281. .iconfont{
  282. position: absolute;
  283. right: -15rpx;
  284. top: -20rpx;
  285. font-size: 40rpx;
  286. color: $theme-color;
  287. }
  288. }
  289. .add-img{
  290. display: flex;
  291. flex-direction: column;
  292. align-items: center;
  293. justify-content: center;
  294. width: 156rpx;
  295. height: 156rpx;
  296. margin-top: 20rpx;
  297. border: 1px solid #DDDDDD;
  298. border-radius: 3rpx;
  299. color: #BBBBBB;
  300. font-size: 24rpx;
  301. .iconfont{
  302. margin-bottom: 10rpx;
  303. font-size: 50rpx;
  304. }
  305. }
  306. }
  307. }
  308. .btn-box{
  309. width:690rpx;
  310. height:86rpx;
  311. margin: 70rpx auto;
  312. line-height: 86rpx;
  313. text-align: center;
  314. color: #fff;
  315. background:var(--view-theme);
  316. border-radius:43rpx;
  317. font-size: 32rpx;
  318. }
  319. }
  320. </style>