orderRefund.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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. <view class="title clamp">
  13. <text>{{ goodsItem.productInfo.store_name }}</text>
  14. <view class="time">下单时间:{{ item.add_time_y }}</view>
  15. </view>
  16. <view class="right-row">
  17. <text class="price">{{ goodsItem.productInfo.price }}</text>
  18. <text class="attr-box">{{ goodsItem.attrInfo ? goodsItem.attrInfo.suk : '' }} x {{ goodsItem.cart_num }}</text>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- <view class="row b-b">
  24. <text class="tit">货物状态</text>
  25. <picker mode="selector" :range="value" @change="bindChange">
  26. <view class="refund" v-if="refund">{{ refund || '请选择' }}</view>
  27. <view class="noRefund" v-else>请选择</view>
  28. </picker>
  29. </view> -->
  30. <view class="orderDetial">
  31. <view class="row b-b flex">
  32. <text class="tit">退款原因</text>
  33. <picker mode="selector" :range="value" @change="bindChange">
  34. <view class="refund" v-if="refund">{{ refund || '请选择' }}</view>
  35. <view class="noRefund" v-else>请选择</view>
  36. </picker>
  37. <!-- <view class="input"><input class="uni-input" @input="onKeyInput" placeholder="请输入退款原因 "/></view> -->
  38. </view>
  39. <view class="row b-b">
  40. <text class="tit">备注说明</text>
  41. <input class="input" type="text" v-model="reason" placeholder="请填写备注" placeholder-class="placeholder" />
  42. </view>
  43. <!-- <view class="row b-b flex">
  44. <text class="tit">订单总价</text>
  45. <view class="input">¥{{ item.total_price }}</view>
  46. </view>
  47. <view class="row b-b flex">
  48. <text class="tit">邮费</text>
  49. <view class="input">{{ item.pay_postage > 0 ? '¥' +item.pay_postage : '免邮费' }}</view>
  50. </view>
  51. <view class="row b-b flex" v-if="item.coupon_id > 0">
  52. <text class="tit">优惠券</text>
  53. <view class="input">-¥{{ item.coupon_price }}</view>
  54. </view>
  55. <view class="row b-b flex" v-if="item.use_integral > 0">
  56. <text class="tit">积分抵扣</text>
  57. <view class="input">-¥{{ item.use_integral }}</view>
  58. </view>
  59. <view class="row b-b flex">
  60. <text class="tit ">实付</text>
  61. <view class="input payColor">¥{{ item.pay_price }}</view>
  62. </view> -->
  63. </view>
  64. <!-- <view class="row b-b">
  65. <text class="tit">退款方式</text>
  66. <picker mode="selector" :range="value" @change="bindChange">
  67. <view class="refund" v-if="refund">{{ refund || '请选择' }}</view>
  68. <view class="noRefund" v-else>请选择</view>
  69. </picker>
  70. </view> -->
  71. <view class="row b-b" style="margin: 20rpx 0;">
  72. <text class="tit">退款金额</text>
  73. <text class="red">¥{{item.pay_price}}</text>
  74. </view>
  75. <!-- <view class="row b-b">
  76. <text class="tit">退款理由</text>
  77. <picker mode="selector" :range="value" @change="bindChange">
  78. <view class="refund" v-if="refund">{{ refund || '请选择退款理由' }}</view>
  79. <view class="noRefund" v-else>请选择退款理由</view>
  80. </picker>
  81. </view> -->
  82. <view class="add_box">
  83. <view class="add_name">上传凭证</view>
  84. <view class="add-img-box flex_item">
  85. <view class="add-img-item" v-for="(item, index) in imgList" :key="index">
  86. <image class="add-img" @click.stop="imgInfo(index)" :src="item.url" mode="aspectFill"></image>
  87. <image class="add-img-del" @click.stop="delImg(index)" src="/static/img/delete.png"></image>
  88. </view>
  89. <view v-if="imgList.length < 9" class="add-img-item" @click.stop="scImg()">
  90. <image class="add-img" src="https://mmz.liuniu946.com/statics/img/add.jpg"></image>
  91. </view>
  92. </view>
  93. </view>
  94. <button class="add-btn" @click="confirm">提交申请</button>
  95. </view>
  96. </template>
  97. <script>
  98. import { refund, refundReason, orderDetail,upload } from '@/api/order.js';
  99. export default {
  100. data() {
  101. return {
  102. selector:'',//理由
  103. refund: '', //退款理由
  104. reason: '', //备注
  105. value: ['1', '2', '3', '4', '5', '6', '7', '8', 9, 10, 11, 12, 13],
  106. orderId: '',
  107. item: {},
  108. listStyle: 2,
  109. imgList: [],
  110. imgCount: 6 ,//最多支持9张上传,可以修改
  111. cloudimgList: []
  112. };
  113. },
  114. onLoad(option) {
  115. this.orderId = option.id;
  116. this.refundReason();
  117. this.loadOrder();
  118. },
  119. methods: {
  120. // 切换选中事件
  121. bindChange(e) {
  122. this.refund = this.value[e.detail.value];
  123. },
  124. // 加载退款理由
  125. refundReason() {
  126. refundReason({}).then(e => {
  127. this.value = e.data;
  128. });
  129. },
  130. loadOrder() {
  131. orderDetail({}, this.orderId).then(e => {
  132. this.item = e.data;
  133. });
  134. },
  135. //单张上传图片
  136. scImg() {
  137. let obj = this;
  138. if (obj.imgCount == 0) {
  139. uni.showToast({
  140. title: '最多添加6张图片',
  141. icon: 'none'
  142. });
  143. return;
  144. }
  145. upload({
  146. file: ''
  147. })
  148. .then(e => {
  149. console.log(e,'e')
  150. obj.imgList = [...obj.imgList, ...e];
  151. obj.imgCount = 6 - obj.imgList.length;
  152. })
  153. .catch(e => {});
  154. },
  155. //提交
  156. confirm() {
  157. let obj = this;
  158. if (!obj.refund) {
  159. obj.$api.msg('请选择退货理由');
  160. return false;
  161. }
  162. for (let i = 0; i < obj.imgList.length; i++) {
  163. obj.cloudimgList.push(obj.imgList[i].url);
  164. }
  165. let arr = obj.cloudimgList.join(',');
  166. refund({
  167. text: obj.refund,
  168. uni: obj.orderId,
  169. refund_reason_wap_explain: obj.reason,
  170. refund_reason_wap_img:arr
  171. }).then(function(e) {
  172. console.log(e,'e')
  173. obj.$api.msg('提交成功');
  174. setTimeout(function() {
  175. uni.navigateTo({
  176. url:'/pages/order/order?state=-3'
  177. })
  178. }, 1000);
  179. // uni.showToast({
  180. // title:'提交成功',
  181. // duration:1500,
  182. // icon:'none'
  183. // })
  184. });
  185. },
  186. //点击图片显示大图
  187. imgInfo(i) {
  188. let tempList = [];
  189. this.imgList.forEach(e => {
  190. tempList.push(e.url);
  191. });
  192. console.log(tempList);
  193. //显示图片
  194. uni.previewImage({
  195. current: i,
  196. loop: false,
  197. urls: tempList,
  198. indicator: 'default'
  199. });
  200. },
  201. //删除图片
  202. delImg(i) {
  203. uni.showModal({
  204. content: '确定删除这张吗',
  205. success: res => {
  206. if (res.confirm) {
  207. this.imgList.splice(i, 1);
  208. this.imgCount++;
  209. } else if (res.cancel) {
  210. }
  211. }
  212. });
  213. },
  214. }
  215. };
  216. </script>
  217. <style lang="scss">
  218. page {
  219. background: $page-color-base;
  220. padding-top: 16rpx;
  221. }
  222. .orderDetial {
  223. .row {
  224. .input {
  225. text-align: left;
  226. }
  227. }
  228. }
  229. //图片
  230. .add_box{
  231. background-color: #ffffff;
  232. padding: 25rpx 0rpx;
  233. border-bottom: 1px solid #e4e7ed;
  234. .add_name{
  235. font-size: 30rpx;
  236. padding-left: 25rpx;
  237. }
  238. }
  239. .add-img-box {
  240. width: 100%;
  241. flex-direction: row;
  242. flex-wrap: wrap;
  243. margin-top: 50rpx;
  244. }
  245. .add-img-item {
  246. width: 150rpx;
  247. height: 150rpx;
  248. border-radius: 24rpx;
  249. position: relative;
  250. margin-bottom: 80rpx;
  251. margin-left: 55rpx;
  252. .add-img {
  253. width: 100%;
  254. height: 100%;
  255. border-radius: 24rpx;
  256. }
  257. }
  258. .add-img-camera {
  259. flex: 1;
  260. }
  261. .add-img-del {
  262. position: absolute;
  263. width: 40rpx;
  264. height: 40rpx;
  265. left: 135rpx;
  266. bottom: 135rpx;
  267. //background-color: rgba(238, 0, 0, 1);
  268. border-radius: 20rpx;
  269. }
  270. .address-time {
  271. width: 484rpx;
  272. height: 88rpx;
  273. background-color: rgba(245, 245, 245, 1);
  274. opacity: 1;
  275. border-radius: 24rpx;
  276. text-align: center;
  277. font-size: 35rpx;
  278. font-weight: 500;
  279. color: rgba(51, 51, 51, 1);
  280. }
  281. .line {
  282. width: 750rpx;
  283. height: 1px;
  284. transform: scaleY(0.3);
  285. background-color: rgba(0, 0, 0, 0.5);
  286. }
  287. .row {
  288. display: flex;
  289. align-items: center;
  290. position: relative;
  291. padding: 0 30rpx;
  292. height: 110rpx;
  293. background: #fff;
  294. image{
  295. width: 13rpx;
  296. height: 24rpx;
  297. }
  298. .refund {
  299. font-size: 30rpx;
  300. color: $font-color-dark;
  301. }
  302. .noRefund {
  303. font-size: 30rpx;
  304. color: $font-color-light;
  305. padding-left: 20rpx;
  306. }
  307. .tit {
  308. flex-shrink: 0;
  309. width: 160rpx;
  310. font-size: 30rpx;
  311. color: $font-color-dark;
  312. }
  313. .red{
  314. font-size:30rpx;
  315. font-weight:500;
  316. color:rgba(252,65,65,1);
  317. line-height:100rpx;
  318. }
  319. .input {
  320. flex: 1;
  321. font-size: 30rpx;
  322. color: $font-color-dark;
  323. padding-left: 20rpx;
  324. &.payColor {
  325. color: $color-red;
  326. }
  327. }
  328. .iconlocation {
  329. font-size: 36rpx;
  330. color: $font-color-light;
  331. }
  332. }
  333. .add-btn {
  334. display: flex;
  335. align-items: center;
  336. justify-content: center;
  337. width: 560rpx;
  338. height: 80rpx;
  339. margin: 60rpx auto;
  340. font-size: $font-lg;
  341. color: #fff;
  342. background-color: $base-color;
  343. border-radius: 40rpx;
  344. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  345. }
  346. /* 多条商品 */
  347. .order-item {
  348. display: flex;
  349. flex-direction: column;
  350. padding-left: 30rpx;
  351. background: #fff;
  352. margin-top: 16rpx;
  353. .goods-box {
  354. height: 160rpx;
  355. padding: 20rpx 0;
  356. white-space: nowrap;
  357. .goods-item {
  358. width: 120rpx;
  359. height: 120rpx;
  360. display: inline-block;
  361. margin-right: 24rpx;
  362. }
  363. .goods-img {
  364. display: block;
  365. width: 100%;
  366. height: 100%;
  367. }
  368. }
  369. /* 单条商品 */
  370. .goods-box-single {
  371. display: flex;
  372. padding: 20rpx 0;
  373. .goods-img {
  374. display: block;
  375. width: 120rpx;
  376. height: 120rpx;
  377. }
  378. .right {
  379. flex: 1;
  380. display: flex;
  381. justify-content: space-between;
  382. // flex-direction: column;
  383. padding: 0 30rpx 0 24rpx;
  384. overflow: hidden;
  385. .title {
  386. font-size: $font-base + 2rpx;
  387. color: $font-color-dark;
  388. line-height: 1;
  389. margin-top: 10rpx;
  390. text-overflow: -o-ellipsis-lastline;
  391. overflow: hidden;
  392. text-overflow: ellipsis;
  393. display: -webkit-box;
  394. -webkit-line-clamp: 2;
  395. -webkit-box-orient: vertical;
  396. .time{
  397. font-size:22rpx;
  398. font-weight:400;
  399. color:#999999;
  400. margin-top: 50rpx;
  401. }
  402. }
  403. .right-row{
  404. display: flex;
  405. align-items: flex-end;
  406. justify-content: flex-end;
  407. flex-direction: column;
  408. .attr-box {
  409. font-size: $font-sm + 2rpx;
  410. color: $font-color-light;
  411. padding: 10rpx 12rpx;
  412. }
  413. .price {
  414. font-size: $font-base + 2rpx;
  415. color: $font-color-dark;
  416. &:before {
  417. content: '¥';
  418. font-size: $font-sm;
  419. margin: 0 2rpx 0 8rpx;
  420. }
  421. }
  422. }
  423. }
  424. }
  425. }
  426. </style>