noService.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <view class="list" v-for="(item,index) in goodsList" :key="index" >
  6. <view class="list_1">
  7. <text>退款商品</text>
  8. </view>
  9. <view class="list_2">
  10. <view class="l">
  11. <image class="image"
  12. :src="item.goods.file&&item.goods.file.length>0?item.goods.file[0].url:''" mode="">
  13. </image>
  14. </view>
  15. <view class="c">
  16. <view class="name">
  17. {{item.name}}
  18. </view>
  19. </view>
  20. <view class="r">
  21. <view v-if="item.type=='0'" class="price">
  22. ¥{{item.sell_money}}
  23. </view>
  24. <view v-else class="price">
  25. ¥{{item.group_config.money}}
  26. </view>
  27. <view class="num">
  28. ×{{item.buy_num}}
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="two">
  35. <uni-forms ref="form" :rules="rules" :model="form" label-width="auto">
  36. <uni-forms-item label="申请售后理由" name="desc">
  37. <uni-easyinput type="textarea" v-model="form.desc" placeholder="请输入申请售后描述" />
  38. </uni-forms-item>
  39. <view class="btn">
  40. <button type="primary" size="mini" @click="onSubmit('form')">提交保存</button>
  41. </view>
  42. </uni-forms>
  43. </view>
  44. </view>
  45. </mobile-frame>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. id: '',
  52. user: {},
  53. form: {},
  54. // 退货商品
  55. goodsList: [],
  56. icon: [],
  57. rules: {
  58. desc: {
  59. rules: [{
  60. required: true,
  61. errorMessage: '请输入申请售后描述',
  62. }]
  63. },
  64. },
  65. };
  66. },
  67. onLoad: async function(e) {
  68. const that = this;
  69. that.$set(that, `id`, e && e.id || '');
  70. // 监听用户登录
  71. that.watchLogin();
  72. },
  73. methods: {
  74. // 提交保存
  75. async onSubmit(ref) {
  76. const that = this;
  77. that.$refs[ref].validate().then(async params => {
  78. params.order_detail = that.id
  79. const arr = await that.$api(`/afterSale/orderCancel`, 'POST', params);
  80. if (arr.errcode == '0') {
  81. uni.showToast({
  82. title: `申请售后成功`,
  83. icon: 'success',
  84. });
  85. uni.navigateBack({
  86. detail: 1
  87. })
  88. } else {
  89. uni.showToast({
  90. title: arr.errmsg,
  91. icon: 'none',
  92. })
  93. }
  94. })
  95. },
  96. // 监听用户是否登录
  97. watchLogin() {
  98. const that = this;
  99. uni.getStorage({
  100. key: 'token',
  101. success: async function(res) {
  102. let user = that.$jwt(res.data);
  103. if (user) {
  104. that.$set(that, `user`, user);
  105. if (that.id) {
  106. let arr = await that.$api(`/orderDetail/${that.id}`, 'GET')
  107. if (arr.errcode == '0') {
  108. that.$set(that, `goodsList`, arr.data.goods)
  109. }
  110. }
  111. }
  112. },
  113. fail: function(err) {
  114. uni.reLaunch({
  115. url: '/pages/login/index'
  116. })
  117. }
  118. })
  119. },
  120. }
  121. }
  122. </script>
  123. <style lang="scss">
  124. .main {
  125. .one {
  126. .list {
  127. margin: 2vw;
  128. padding: 2vw;
  129. border-radius: 2vw;
  130. border: 1px solid #3333;
  131. .list_1 {
  132. margin: 0 0 1vw 0;
  133. display: flex;
  134. flex-direction: row;
  135. justify-content: space-between;
  136. font-size: var(--font14Size);
  137. font-weight: bold;
  138. }
  139. .list_2 {
  140. margin: 0 0 1vw 0;
  141. display: flex;
  142. .l {
  143. width: 20vw;
  144. .image {
  145. width: 100%;
  146. height: 20vw;
  147. border-radius: 5px;
  148. }
  149. }
  150. .c {
  151. width: 50vw;
  152. padding: 0 2vw;
  153. }
  154. .r {
  155. width: 25vw;
  156. text-align: right;
  157. }
  158. }
  159. .other {
  160. margin: 0 0 2vw 0;
  161. text-align: right;
  162. text {
  163. font-size: 14px;
  164. padding: 0 0 0 2vw;
  165. }
  166. }
  167. .btn {
  168. text-align: right;
  169. margin: 2vw 0 0 0;
  170. border-top: 1px solid #f1fff1;
  171. button {
  172. margin: 2vw 0 0 2vw;
  173. }
  174. }
  175. }
  176. }
  177. .two {
  178. padding: 2vw;
  179. .btn {
  180. text-align: center;
  181. button {
  182. width: 30%;
  183. font-size: 14px;
  184. background-color: var(--f35BColor);
  185. }
  186. }
  187. }
  188. }
  189. .uni-forms-item {
  190. margin-bottom: 6vw !important;
  191. display: flex;
  192. flex-direction: row;
  193. }
  194. </style>