orderRefund.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <view class="content">
  3. <view class="order-item">
  4. <scroll-view v-if="listStyle == 1" class="goods-box" scroll-x>
  5. <view v-for="(goodsItem, goodsIndex) in item.cartInfo" :key="goodsIndex" class="goods-item">
  6. <image class="goods-img" :src="goodsItem.productInfo.image" mode="aspectFill"></image>
  7. </view>
  8. </scroll-view>
  9. <!-- <view v-if="listStyle == 2" class="goods-box-single" v-for="(goodsItem, goodsIndex) in item.cartInfo" :key="goodsIndex">
  10. <image class="goods-img" :src="goodsItem.productInfo.image" mode="aspectFill"></image>
  11. <view class="right">
  12. <text class="title clamp">{{ goodsItem.productInfo.store_name }}</text>
  13. <text class="attr-box">{{ goodsItem.attrInfo ? goodsItem.attrInfo.suk : '' }} x {{ goodsItem.cart_num }}</text>
  14. <text class="price">{{ goodsItem.productInfo.price }}</text>
  15. </view>
  16. </view> -->
  17. <view class="good" v-if="listStyle == 2" v-for="(goodsItem, goodsIndex) in item.cartInfo" :key="goodsIndex">
  18. <view class="img-wrapper"><image :src="goodsItem.productInfo.image" mode=""></image></view>
  19. <view class="good-infoo">
  20. <view class="good-name ellipsis">{{ goodsItem.productInfo.store_name }}</view>
  21. <view class="create-time">下单时间:{{item.add_time_y}}</view>
  22. </view>
  23. <view class="good-infot">
  24. <view class="good-price">¥{{ goodsItem.productInfo.attrInfo.price }}</view>
  25. <view class="good-num">X{{ goodsItem.cart_num }}</view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="row b-b">
  30. <text class="tit">退款原因</text>
  31. <picker mode="selector" :range="status" @change="bindChange">
  32. <view class="refund" v-if="refundStatus">{{ refundStatus || '请选择' }}</view>
  33. <view class="noRefund" v-else>请选择退款原因</view>
  34. </picker>
  35. </view>
  36. <view class="pushpic">
  37. <view class="up-title">上传凭证:</view>
  38. <view class="up" @click="putImg()">
  39. <view class="up-bg" v-if="upImg == ''">
  40. <image src="../../static/icon/uping.png" mode=""></image>
  41. <view class="up-tap">上传图片</view>
  42. </view>
  43. <view class="up-img" v-else>
  44. <image :src="upImg" mode=""></image>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="row b-b">
  49. <text class="tit">备注说明</text>
  50. <input class="input" type="text" v-model="reason" placeholder="如果请填写" placeholder-class="placeholder" />
  51. </view>
  52. <button class="add-btn" @click="confirm">提交申请</button>
  53. </view>
  54. </template>
  55. <script>
  56. import { refund, refundReason, orderDetail,upload } from '@/api/order.js';
  57. export default {
  58. data() {
  59. return {
  60. refundStatus: '', //退款理由
  61. refundMethods: '', //退款方式
  62. reason: '', //退款理由
  63. status: ['代付款', '待发货', '待收货', '已完成'],
  64. orderId: '',
  65. item: {},
  66. listStyle: 2,
  67. refundNum: 0,
  68. methods: ['余额'],
  69. isUp: true,
  70. upImg: ''
  71. };
  72. },
  73. onLoad(option) {
  74. this.orderId = option.id;
  75. this.refundReason();
  76. this.loadOrder();
  77. },
  78. methods: {
  79. // 切换选中事件
  80. bindChange(e) {
  81. this.refundStatus = this.status[e.detail.value];
  82. console.log('this.refundStatus',this.refundStatus)
  83. },
  84. bind2Change(e) {
  85. this.refundMethods = this.methods[e.detail.value];
  86. },
  87. // 加载退款理由
  88. refundReason() {
  89. refundReason({}).then(e => {
  90. this.status = e.data;
  91. });
  92. },
  93. loadOrder() {
  94. orderDetail({}, this.orderId).then(e => {
  95. this.item = e.data;
  96. console.log(this.item)
  97. });
  98. },
  99. //提交
  100. confirm() {
  101. let obj = this;
  102. if (!obj.refundStatus) {
  103. uni.showModal({
  104. title: '错误',
  105. content: '请填写退货理由',
  106. showCancel: false
  107. });
  108. return false;
  109. }
  110. uni.showLoading({
  111. title: '提交中...',
  112. mask: true
  113. })
  114. refund({
  115. text: obj.refundStatus,
  116. uni: obj.orderId,
  117. refund_reason_wap_explain: obj.reason,
  118. refund_reason_wap_img: obj.upImg
  119. }).then(function(e) {
  120. uni.showToast({
  121. title: '提交成功',
  122. duration: 1500
  123. });
  124. setTimeout(function() {
  125. uni.navigateBack();
  126. }, 800);
  127. }).catch( err => {
  128. console.log(err)
  129. });
  130. },
  131. putImg() {
  132. console.log('dianji')
  133. // this.isUp = !this.isUp
  134. upload({
  135. filename: ''
  136. }).then(data => {
  137. console.log(data,'6666666666')
  138. this.upImg = data[0].url
  139. });
  140. }
  141. }
  142. };
  143. </script>
  144. <style lang="scss">
  145. page {
  146. background: $page-color-base;
  147. padding-top: 16rpx;
  148. }
  149. .orderDetial {
  150. .row {
  151. .input {
  152. text-align: right;
  153. }
  154. }
  155. }
  156. .row {
  157. display: flex;
  158. align-items: center;
  159. position: relative;
  160. padding: 0 30rpx;
  161. height: 110rpx;
  162. background: #fff;
  163. .refund {
  164. font-size: 30rpx;
  165. color: $font-color-dark;
  166. padding-left: 128rpx;
  167. }
  168. .noRefund {
  169. font-size: 30rpx;
  170. color: $font-color-light;
  171. padding-left: 128rpx;
  172. }
  173. .tit {
  174. flex-shrink: 0;
  175. width: 120rpx;
  176. font-size: 30rpx;
  177. color: $font-color-dark;
  178. }
  179. .input {
  180. flex: 1;
  181. font-size: 30rpx;
  182. color: $font-color-dark;
  183. padding-left: 128rpx;
  184. &.payColor {
  185. color: $color-red;
  186. }
  187. }
  188. .iconlocation {
  189. font-size: 36rpx;
  190. color: $font-color-light;
  191. }
  192. }
  193. .add-btn {
  194. display: flex;
  195. align-items: center;
  196. justify-content: center;
  197. width: 690rpx;
  198. height: 80rpx;
  199. margin: 60rpx auto;
  200. font-size: $font-lg;
  201. color: #fff;
  202. background-color: $base-color;
  203. border-radius: 10rpx;
  204. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  205. }
  206. /* 多条商品 */
  207. .order-item {
  208. display: flex;
  209. flex-direction: column;
  210. // padding-left: 30rpx;
  211. background: #fff;
  212. margin-top: 16rpx;
  213. .goods-box {
  214. height: 160rpx;
  215. padding: 20rpx 0;
  216. white-space: nowrap;
  217. .goods-item {
  218. width: 120rpx;
  219. height: 120rpx;
  220. display: inline-block;
  221. margin-right: 24rpx;
  222. }
  223. .goods-img {
  224. display: block;
  225. width: 100%;
  226. height: 100%;
  227. }
  228. }
  229. /* 单条商品 */
  230. .goods-box-single {
  231. display: flex;
  232. padding: 20rpx 0;
  233. .goods-img {
  234. display: block;
  235. width: 120rpx;
  236. height: 120rpx;
  237. }
  238. .right {
  239. flex: 1;
  240. display: flex;
  241. flex-direction: column;
  242. padding: 0 30rpx 0 24rpx;
  243. overflow: hidden;
  244. .title {
  245. font-size: $font-base + 2rpx;
  246. color: $font-color-dark;
  247. line-height: 1;
  248. }
  249. .attr-box {
  250. font-size: $font-sm + 2rpx;
  251. color: $font-color-light;
  252. padding: 10rpx 12rpx;
  253. }
  254. .price {
  255. font-size: $font-base + 2rpx;
  256. color: $font-color-dark;
  257. &:before {
  258. content: '¥';
  259. font-size: $font-sm;
  260. margin: 0 2rpx 0 8rpx;
  261. }
  262. }
  263. }
  264. }
  265. }
  266. .refund-num {
  267. margin: 20rpx 0;
  268. width: 750rpx;
  269. height: 100rpx;
  270. background: #ffffff;
  271. line-height: 100rpx;
  272. view {
  273. display: inline-block;
  274. }
  275. .num-title {
  276. font-size: 30rpx;
  277. font-family: PingFangSC;
  278. font-weight: 500;
  279. color: #333333;
  280. padding-left: 30rpx;
  281. }
  282. .num {
  283. padding-left: 133rpx;
  284. font-size: 30rpx;
  285. font-family: PingFang SC;
  286. font-weight: bold;
  287. color: #901b21;
  288. }
  289. }
  290. .good {
  291. // margin-top: 21rpx;
  292. margin-bottom: 18rpx;
  293. width: 750rpx;
  294. height: 220rpx;
  295. background: #ffffff;
  296. padding: 30rpx 29rpx;
  297. display: flex;
  298. position: relative;
  299. .img-wrapper {
  300. width: 160rpx;
  301. height: 160rpx;
  302. image {
  303. width: 100%;
  304. height: 100%;
  305. border-radius: 5rpx;
  306. }
  307. }
  308. .good-infoo {
  309. padding-left: 20rpx;
  310. .good-name {
  311. width: 282rpx;
  312. font-size: 26rpx;
  313. font-family: PingFang SC;
  314. font-weight: 400;
  315. color: #1d2023;
  316. line-height: 40rpx;
  317. margin-bottom: 40rpx;
  318. }
  319. .create-time {
  320. height: 21rpx;
  321. font-size: 22rpx;
  322. font-family: PingFang SC;
  323. font-weight: 400;
  324. color: #999999;
  325. }
  326. }
  327. .good-infot {
  328. position: absolute;
  329. right: 29rpx;
  330. text-align: right;
  331. font-size: 26rpx;
  332. font-family: PingFang SC;
  333. font-weight: 400;
  334. color: #666666;
  335. .good-num {
  336. font-size: 22rpx;
  337. }
  338. }
  339. }
  340. .pushpic {
  341. margin-top: 20rpx;
  342. width: 750rpx;
  343. height: 284rpx;
  344. background: #FFFFFF;
  345. padding: 30rpx 0 0 30rpx;
  346. .up-title {
  347. font-size: 30rpx;
  348. font-family: PingFang SC;
  349. font-weight: 400;
  350. color: #3F454B;
  351. line-height: 1;
  352. padding-bottom: 35rpx;
  353. }
  354. .up {
  355. .up-bg {
  356. width: 160rpx;
  357. height: 160rpx;
  358. background: #fff;
  359. border: 2rpx #999999 dashed;
  360. border-radius: 10rpx;
  361. position: relative;
  362. image {
  363. width: 36rpx;
  364. height: 36rpx;
  365. position: absolute;
  366. top: 44rpx;
  367. left:64rpx;
  368. }
  369. .up-tap {
  370. position: absolute;
  371. // width: 94rpx;
  372. height: 23rpx;
  373. font-size: 24rpx;
  374. font-family: PingFangSC;
  375. font-weight: 500;
  376. color: #888888;
  377. top: 93rpx;
  378. left:33rpx;
  379. }
  380. }
  381. .up-img {
  382. width: 160rpx;
  383. height: 160rpx;
  384. background: #fff;
  385. // border: 2rpx #999999 dashed;
  386. border-radius: 10rpx;
  387. image {
  388. width: 100%;
  389. height: 100%;
  390. border-radius: 10rpx;
  391. }
  392. }
  393. }
  394. }
  395. </style>