noService.vue 3.9 KB

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