orderRefund.vue 5.7 KB

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