orderRefund.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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"
  10. :key="goodsIndex">
  11. <image class="goods-img" :src="goodsItem.productInfo.image" mode="aspectFill"></image>
  12. <view class="right">
  13. <text class="title clamp">{{ goodsItem.productInfo.store_name }}</text>
  14. <text class="attr-box">{{ goodsItem.attrInfo ? goodsItem.attrInfo.suk : '' }} x
  15. {{ goodsItem.cart_num }}</text>
  16. <text class="price">{{ goodsItem.productInfo.price }}</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="orderDetial">
  21. <view class="row b-b flex">
  22. <text class="tit">订单总价</text>
  23. <view class="input">¥{{ item.total_price }}</view>
  24. </view>
  25. <view class="row b-b flex">
  26. <text class="tit">邮费</text>
  27. <view class="input">{{ item.pay_postage > 0 ? '¥' +item.pay_postage : '免邮费' }}</view>
  28. </view>
  29. <view class="row b-b flex" v-if="item.coupon_id > 0">
  30. <text class="tit">优惠券</text>
  31. <view class="input">-¥{{ item.coupon_price }}</view>
  32. </view>
  33. <view class="row b-b flex" v-if="item.use_integral > 0">
  34. <text class="tit">积分抵扣</text>
  35. <view class="input">-¥{{ item.use_integral }}</view>
  36. </view>
  37. <view class="row b-b flex">
  38. <text class="tit ">实付</text>
  39. <view class="input payColor">¥{{ item.pay_price }}</view>
  40. </view>
  41. </view>
  42. <view class="row b-b">
  43. <text class="tit">退款理由</text>
  44. <picker mode="selector" :range="value" @change="bindChange">
  45. <view class="refund" v-if="refund">{{ refund || '请选择退款理由' }}</view>
  46. <view class="noRefund" v-else>请选择退款理由</view>
  47. </picker>
  48. </view>
  49. <view class="row b-b">
  50. <text class="tit">备注说明</text>
  51. <input class="input" type="text" v-model="reason" placeholder="请填写备注" placeholder-class="placeholder" />
  52. </view>
  53. <button class="add-btn" @click="confirm">提交</button>
  54. </view>
  55. </template>
  56. <script>
  57. import {
  58. refund,
  59. refundReason,
  60. orderDetail
  61. } from '@/api/order.js';
  62. export default {
  63. data() {
  64. return {
  65. refund: '', //退款理由
  66. reason: '', //备注
  67. value: ['1', '2', '3', '4', '5', '6', '7', '8', 9, 10, 11, 12, 13],
  68. orderId: '',
  69. item: {},
  70. listStyle: 2
  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.refund = this.value[e.detail.value];
  82. },
  83. // 加载退款理由
  84. refundReason() {
  85. refundReason({}).then(e => {
  86. this.value = e.data;
  87. });
  88. },
  89. loadOrder() {
  90. orderDetail({}, this.orderId).then(e => {
  91. this.item = e.data;
  92. });
  93. },
  94. //提交
  95. confirm() {
  96. let obj = this;
  97. if (!obj.refund) {
  98. uni.showModal({
  99. title: '错误',
  100. content: '请填写退货理由',
  101. showCancel: false
  102. });
  103. return false;
  104. }
  105. refund({
  106. text: obj.refund,
  107. uni: obj.orderId,
  108. refund_reason_wap_explain: obj.reason
  109. }).then(function(e) {
  110. uni.showToast({
  111. title: '提交成功',
  112. duration: 1500
  113. })
  114. });
  115. }
  116. }
  117. };
  118. </script>
  119. <style lang="scss">
  120. page {
  121. background: $page-color-base;
  122. padding-top: 16rpx;
  123. }
  124. .orderDetial {
  125. .row {
  126. .input {
  127. text-align: right;
  128. }
  129. }
  130. }
  131. .row {
  132. display: flex;
  133. align-items: center;
  134. position: relative;
  135. padding: 0 30rpx;
  136. height: 110rpx;
  137. background: #fff;
  138. .refund {
  139. font-size: 30rpx;
  140. color: $font-color-dark;
  141. }
  142. .noRefund {
  143. font-size: 30rpx;
  144. color: $font-color-light;
  145. padding-left: 20rpx;
  146. }
  147. .tit {
  148. flex-shrink: 0;
  149. width: 120rpx;
  150. font-size: 30rpx;
  151. color: $font-color-dark;
  152. }
  153. .input {
  154. flex: 1;
  155. font-size: 30rpx;
  156. color: $font-color-dark;
  157. padding-left: 20rpx;
  158. &.payColor {
  159. color: $color-red;
  160. }
  161. }
  162. .iconlocation {
  163. font-size: 36rpx;
  164. color: $font-color-light;
  165. }
  166. }
  167. .add-btn {
  168. display: flex;
  169. align-items: center;
  170. justify-content: center;
  171. width: 690rpx;
  172. height: 80rpx;
  173. margin: 60rpx auto;
  174. font-size: $font-lg;
  175. color: #fff;
  176. background-color: $base-color;
  177. border-radius: 10rpx;
  178. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  179. }
  180. /* 多条商品 */
  181. .order-item {
  182. display: flex;
  183. flex-direction: column;
  184. padding-left: 30rpx;
  185. background: #fff;
  186. margin-top: 16rpx;
  187. .goods-box {
  188. height: 160rpx;
  189. padding: 20rpx 0;
  190. white-space: nowrap;
  191. .goods-item {
  192. width: 120rpx;
  193. height: 120rpx;
  194. display: inline-block;
  195. margin-right: 24rpx;
  196. }
  197. .goods-img {
  198. display: block;
  199. width: 100%;
  200. height: 100%;
  201. }
  202. }
  203. /* 单条商品 */
  204. .goods-box-single {
  205. display: flex;
  206. padding: 20rpx 0;
  207. .goods-img {
  208. display: block;
  209. width: 120rpx;
  210. height: 120rpx;
  211. }
  212. .right {
  213. flex: 1;
  214. display: flex;
  215. flex-direction: column;
  216. padding: 0 30rpx 0 24rpx;
  217. overflow: hidden;
  218. .title {
  219. font-size: $font-base + 2rpx;
  220. color: $font-color-dark;
  221. line-height: 1;
  222. }
  223. .attr-box {
  224. font-size: $font-sm + 2rpx;
  225. color: $font-color-light;
  226. padding: 10rpx 12rpx;
  227. }
  228. .price {
  229. font-size: $font-base + 2rpx;
  230. color: $font-color-dark;
  231. &:before {
  232. content: '¥';
  233. font-size: $font-sm;
  234. margin: 0 2rpx 0 8rpx;
  235. }
  236. }
  237. }
  238. }
  239. }
  240. </style>