after.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <input type="text" v-model="searchInfo.name" @input="toInput" placeholder="搜索商品">
  6. </view>
  7. <view class="two">
  8. <tabs :tabs="tabs" @tabsChange="tabsChange">
  9. <view class="tabsList">
  10. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
  11. <view class="list-scroll-view">
  12. <view class="list" v-for="(item,index) in list" :key="index" @tap="toInfo(item)">
  13. <view class="list_1">
  14. <view class="shopname">
  15. <text class="iconfont icon-shangdian"></text>
  16. <text>{{item.shop.name}}</text>
  17. </view>
  18. <view class="type">
  19. {{item.zhType||'暂无'}}
  20. </view>
  21. </view>
  22. <view class="list_2">
  23. <image class="image" :src="item.url&&item.url.length>0?item.url[0].url:''"
  24. mode="">
  25. </image>
  26. <view class="other">
  27. <view class="name">
  28. {{item.goods.goods.name||'暂无'}}
  29. </view>
  30. <view class="other_1">
  31. 商品规格:<text>{{item.goods.name||'暂无'}}</text>
  32. </view>
  33. <view class="other_1" v-if="item.type!='2'">
  34. 退款:<text>¥{{item.money||0}}</text>
  35. </view>
  36. <view class="other_1">
  37. 申请时间:<text>{{item.apply_time||'暂无'}}</text>
  38. </view>
  39. <view class="other_1">
  40. 售后描述:<text>{{item.desc||'暂无'}}</text>
  41. </view>
  42. <view class="other_1">
  43. 售后处理人:<text>{{item.handle||'暂无'}}</text>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="btn">
  48. <button type="default" size="mini" @tap.stop="toCancel(item)">取消售后</button>
  49. <button v-if="item.type!='0'" type="default" size="mini"
  50. @tap.stop="toRevise(item)">维护信息</button>
  51. </view>
  52. </view>
  53. </view>
  54. </scroll-view>
  55. </view>
  56. </tabs>
  57. </view>
  58. </view>
  59. </mobile-frame>
  60. </template>
  61. <script>
  62. import tabs from '@/components/tabs/index.vue';
  63. export default {
  64. components: {
  65. tabs
  66. },
  67. data() {
  68. return {
  69. user: {},
  70. list: [],
  71. typeList: [],
  72. total: 0,
  73. skip: 0,
  74. limit: 5,
  75. page: 0,
  76. tabs: {
  77. active: '0',
  78. menu: [{
  79. title: '申请售后',
  80. active: '0'
  81. },
  82. {
  83. title: '正在处理退款',
  84. active: '1'
  85. },
  86. {
  87. title: '已退款',
  88. active: '-1'
  89. },
  90. {
  91. title: '已退货',
  92. active: '-2'
  93. },
  94. {
  95. title: '正在处理换货',
  96. active: '3'
  97. },
  98. {
  99. title: '已换货',
  100. active: '-3'
  101. }
  102. ]
  103. },
  104. status: '0',
  105. };
  106. },
  107. onShow: async function() {
  108. const that = this;
  109. that.clearPage();
  110. // 查询其他信息
  111. await that.searchOther();
  112. // 监听用户登录
  113. await that.watchLogin();
  114. },
  115. methods: {
  116. // 选择选项卡
  117. tabsChange(e) {
  118. const that = this;
  119. that.$set(that.tabs, `active`, e.active)
  120. that.$set(that, `status`, e.active);
  121. that.clearPage();
  122. that.search()
  123. },
  124. // 订单详细
  125. toInfo(item) {
  126. uni.navigateTo({
  127. url: `/pagesMy/order/info?id=${item.order_detail._id}&status=${item.order_detail.status}`
  128. })
  129. },
  130. // 维护信息
  131. toRevise(e) {
  132. uni.navigateTo({
  133. url: `/pagesMy/order/detail?id=${e.id||e._id}`
  134. })
  135. },
  136. // 取消售后
  137. toCancel(e) {
  138. const that = this;
  139. uni.showModal({
  140. title: '提示',
  141. content: '确定删除售后申请吗?',
  142. success: async function(res) {
  143. if (res.confirm) {
  144. const arr = await that.$api(`/afterSale/${e._id}`, 'DELETE');
  145. if (arr.errcode == '0') {
  146. uni.showToast({
  147. title: '删除售后成功',
  148. icon: 'none'
  149. })
  150. that.clearPage();
  151. that.search();
  152. } else {
  153. uni.showToast({
  154. title: arr.errmsg,
  155. icon: 'none'
  156. })
  157. }
  158. }
  159. }
  160. });
  161. },
  162. // 监听用户是否登录
  163. watchLogin() {
  164. const that = this;
  165. uni.getStorage({
  166. key: 'token',
  167. success: function(res) {
  168. let user = that.$jwt(res.data);
  169. if (user) that.$set(that, `user`, user);
  170. that.search();
  171. },
  172. fail: function(err) {
  173. uni.navigateTo({
  174. url: `/pages/login/index`
  175. })
  176. }
  177. });
  178. },
  179. // 查询列表
  180. async search() {
  181. const that = this;
  182. let user = that.user;
  183. let status = that.status;
  184. const arr = await that.$api(`/afterSale`, 'GET', {
  185. customer: user._id,
  186. status: that.status,
  187. });
  188. if (arr.errcode == '0') {
  189. let list = [...that.list, ...arr.data];
  190. for (let val of list) {
  191. let type = that.typeList.find(i => i.value == val.type)
  192. if (type) val.zhType = type.label;
  193. val.url = val?.goods?.goods?.file;
  194. }
  195. that.$set(that, `list`, list)
  196. that.$set(that, `total`, arr.total)
  197. } else {
  198. uni.showToast({
  199. title: arr.errmsg,
  200. });
  201. }
  202. },
  203. // 查询其他信息
  204. async searchOther() {
  205. const that = this;
  206. let res;
  207. res = await that.$api(`/dictData`, 'GET', {
  208. code: "afterSale_type"
  209. });
  210. if (res.errcode == '0') {
  211. that.$set(that, `typeList`, res.data)
  212. }
  213. },
  214. // 分页
  215. toPage(e) {
  216. const that = this;
  217. let list = that.list;
  218. let limit = that.limit;
  219. if (that.total > list.length) {
  220. uni.showLoading({
  221. title: '加载中',
  222. mask: true
  223. })
  224. let page = that.page + 1;
  225. that.$set(that, `page`, page)
  226. let skip = page * limit;
  227. that.$set(that, `skip`, skip)
  228. that.search();
  229. uni.hideLoading();
  230. } else uni.showToast({
  231. title: '没有更多数据了'
  232. });
  233. },
  234. // 清空列表
  235. clearPage() {
  236. const that = this;
  237. that.$set(that, `list`, [])
  238. that.$set(that, `skip`, 0)
  239. that.$set(that, `limit`, 5)
  240. that.$set(that, `page`, 0)
  241. }
  242. }
  243. }
  244. </script>
  245. <style lang="scss">
  246. .main {
  247. display: flex;
  248. flex-direction: column;
  249. width: 100vw;
  250. height: 100vh;
  251. .one {
  252. // border-bottom: 1px solid var(--f85Color);
  253. padding: 2vw;
  254. input {
  255. padding: 2vw;
  256. background-color: var(--f1Color);
  257. font-size: var(--font14Size);
  258. border-radius: 5px;
  259. }
  260. }
  261. .two {
  262. position: relative;
  263. flex-grow: 1;
  264. background-color: var(--f9Color);
  265. .tabsList {
  266. position: relative;
  267. width: 100vw;
  268. height: 82vh;
  269. .list {
  270. margin: 2vw;
  271. background-color: var(--fffColor);
  272. padding: 2vw;
  273. width: 92vw;
  274. border-radius: 5px;
  275. .list_1 {
  276. display: flex;
  277. justify-content: space-between;
  278. font-size: var(--font16Size);
  279. margin: 0 0 2vw 0;
  280. .shopname {
  281. text {
  282. margin: 0 0 0 1vw;
  283. }
  284. }
  285. .type {
  286. color: var(--ff0Color);
  287. }
  288. }
  289. .list_2 {
  290. display: flex;
  291. justify-content: space-between;
  292. align-items: center;
  293. .image {
  294. width: 25vw;
  295. height: 25vw;
  296. margin: 0 2vw 1vw 0;
  297. }
  298. .other {
  299. flex-grow: 1;
  300. .name {
  301. font-size: var(--font16Size);
  302. }
  303. .other_1 {
  304. font-size: var(--font14Size);
  305. text {
  306. color: var(--f85Color);
  307. }
  308. }
  309. }
  310. }
  311. .btn {
  312. text-align: right;
  313. button {
  314. margin: 2vw 0 0 2vw;
  315. }
  316. }
  317. }
  318. .list:nth-child(2n) {
  319. margin: 0 0 2vw 0;
  320. }
  321. }
  322. }
  323. }
  324. .scroll-view {
  325. position: absolute;
  326. top: 0;
  327. left: 0;
  328. right: 0;
  329. bottom: 0;
  330. .list-scroll-view {
  331. display: flex;
  332. flex-direction: column;
  333. }
  334. }
  335. </style>