index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <tabs :tabs="tabs" @tabsChange="tabsChange">
  6. <view class="tabsList">
  7. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
  8. <view class="list-scroll-view">
  9. <view class="one_1">
  10. <input type="text" v-model="searchInfo.name" @blur="toInput" placeholder="搜索商品名称">
  11. </view>
  12. <view class="one_2">
  13. <view class="list" v-for="(item, index) in list" :key="index"
  14. @click="toShare(item)">
  15. <view class="list_1" v-if="tabs.active=='0'">
  16. <view class="list_1_1">
  17. <view class="shopname">
  18. <text class="iconfont icon-shangdian"></text>
  19. <text>{{item.shop.name}}</text>
  20. </view>
  21. <view class="status">
  22. {{item.zhStatus||'暂无'}}
  23. </view>
  24. </view>
  25. <view class="list_1_2">
  26. <view class="goods" v-for="(tag,indexs) in item.goods" :key="indexs">
  27. <view class="goods_1">
  28. <image class="image" :src="tag.url" mode=""></image>
  29. </view>
  30. <view class="goods_2">
  31. <view class="goodsname textOver">
  32. {{tag.goods.name}}
  33. </view>
  34. <view class="specs">
  35. {{tag.name}}
  36. </view>
  37. <text v-if="tag.gift.length>0" class="gift">赠品</text>
  38. <text v-if="tag.sp_price" class="act">特价</text>
  39. </view>
  40. <view class="goods_3">
  41. <view v-if="item.type=='0'" class="price">
  42. ¥{{tag.price||tag.sell_money}}
  43. </view>
  44. <view v-else class="price">
  45. ¥{{tag.group_config.money}}
  46. </view>
  47. <view class="num">
  48. ×{{tag.buy_num}}
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="other">
  54. <text>共{{item.buy_num_total||0}}件商品</text>
  55. <text>实付款¥{{item.real_pay}}</text>
  56. </view>
  57. <view class="btn">
  58. <button v-if="item.status=='0'" size="mini"
  59. @tap.stop="toCancel(item)">取消订单</button>
  60. <button v-if="item.status=='0'" size="mini"
  61. @tap.stop="toPay(item)">支付</button>
  62. <button v-if="item.status=='1'&&item.is_afterSale!=true" size="mini"
  63. @tap.stop="toCancels(item)">取消订单</button>
  64. <button v-if="item.status=='2'||item.status=='3'||item.status=='2-'"
  65. size="mini" @tap.stop="toLogi(item)">查看物流</button>
  66. <button v-if="item.status=='2'&&item.is_afterSale!=true" size="mini"
  67. @tap.stop="toConfirm(item)">确认收货</button>
  68. <button
  69. v-if="item.status=='2'||item.status=='2-'&&item.is_afterSale!=true"
  70. size="mini" @tap.stop="toReject(item)">拒收</button>
  71. <button v-if="item.status=='3'" size="mini"
  72. @tap.stop="toAfter(item)">申请售后</button>
  73. <button v-if="item.status=='3'" type="default" size="mini"
  74. @tap.stop="toAppraise(item)">{{item.rate?'追加评价':'立即评价'}}</button>
  75. </view>
  76. </view>
  77. <view class="list_2" v-else-if="tabs.active=='-1'">
  78. <view class="list_2_1">
  79. <view class="shopname">
  80. <text class="iconfont icon-shangdian"></text>
  81. <text>{{item.shop.name}}</text>
  82. </view>
  83. <view class="type">
  84. {{item.zhType||'暂无'}}
  85. </view>
  86. </view>
  87. <view class="list_2_2">
  88. <image class="image"
  89. :src="item.url&&item.url.length>0?item.url[0].url:''" mode="">
  90. </image>
  91. <view class="other">
  92. <view class="name textOver">
  93. {{item.goods.goods.name||'暂无'}}
  94. </view>
  95. <view class="other_1">
  96. 商品规格:<text>{{item.goods.name||'暂无'}}</text>
  97. </view>
  98. <view class="other_1" v-if="item.type!='3'">
  99. 退款:<text>¥{{item.money||0}}</text>
  100. </view>
  101. <view class="other_1">
  102. 申请时间:<text>{{item.apply_time||'暂无'}}</text>
  103. </view>
  104. <view class="other_1">
  105. 售后类型:<text>{{item.zhStatus||'暂无'}}</text>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="btn">
  110. <button type="default" size="mini"
  111. @tap.stop="toView(item)">详细信息</button>
  112. <button v-if="item.status=='0'" type="default" size="mini"
  113. @tap.stop="toCancel(item)">取消售后</button>
  114. <button
  115. v-if="item.type!='1'&&item.status=='2'||item.status=='3'&&!item.transport.shop_receive"
  116. type="default" size="mini"
  117. @tap.stop="toMaintain(item)">维护单号</button>
  118. <button
  119. v-if="item.type=='3'&&item.status=='3'&&item.transport.shop_receive==true"
  120. type="default" size="mini" @tap.stop="toLogi(item)">查看物流</button>
  121. <button
  122. v-if="item.type=='3'&&item.status=='3'&&item.transport.shop_receive==true&&!item.transport.customer_receive"
  123. type="default" size="mini" @tap.stop="toConfirm(item)">确认收货</button>
  124. </view>
  125. </view>
  126. <view class="list_2" v-else>
  127. <view class="list_2_1">
  128. <view class="shopname">
  129. <text class="iconfont icon-shangdian"></text>
  130. <text>{{item.shop_name||'暂无'}}</text>
  131. </view>
  132. <view class="type">
  133. {{item.zhStatus||'暂无'}}
  134. </view>
  135. </view>
  136. <view class="list_2_2">
  137. <view class="other">
  138. <view class="name textOver">
  139. {{item.goods_name||'暂无'}}
  140. </view>
  141. <view class="other_1">
  142. 开始时间:<text>{{item.start_time||'暂无'}}</text>
  143. </view>
  144. <view class="other_1">
  145. 结束时间:<text>¥{{item.end_time||'暂无'}}</text>
  146. </view>
  147. <view class="other_1">
  148. 人数限制:<text>{{item.person_limit||'暂无'}}</text>
  149. </view>
  150. </view>
  151. </view>
  152. <view class="btn">
  153. <button type="default" size="mini"
  154. @tap.stop="toView(item)">详细信息</button>
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. </view>
  160. </scroll-view>
  161. </view>
  162. </tabs>
  163. </view>
  164. </view>
  165. </mobile-frame>
  166. </template>
  167. <script>
  168. import moment from 'moment';
  169. import tabs from '@/components/tabs/index.vue';
  170. export default {
  171. components: {
  172. tabs
  173. },
  174. data() {
  175. return {
  176. user: {},
  177. searchInfo: {},
  178. list: [],
  179. total: 0,
  180. skip: 0,
  181. limit: 10,
  182. page: 0,
  183. statusList: [],
  184. tabs: {
  185. active: '0',
  186. menu: [{
  187. title: '团购订单',
  188. active: '0'
  189. },
  190. {
  191. title: '团购售后',
  192. active: '-1'
  193. }
  194. ]
  195. },
  196. // 订单状态
  197. ostatusList: [],
  198. // 售后状态
  199. astatusList: [],
  200. // 团状态
  201. gstatusList: [],
  202. // 售后类型
  203. typeList: [],
  204. };
  205. },
  206. onShow: async function() {
  207. const that = this;
  208. await that.searchOther();
  209. await that.watchLogin();
  210. },
  211. onPullDownRefresh: async function() {
  212. const that = this;
  213. that.clearPage();
  214. await that.search(that.tabs.active)
  215. uni.stopPullDownRefresh();
  216. },
  217. methods: {
  218. // 监听用户是否登录
  219. watchLogin() {
  220. const that = this;
  221. uni.getStorage({
  222. key: 'token',
  223. success: async function(res) {
  224. let user = that.$jwt(res.data);
  225. that.$set(that, `user`, user);
  226. if (user.is_leader == '0' && that.tabs.menu.length <= 2) {
  227. that.tabs.menu.push({
  228. title: '团长处理',
  229. active: '1'
  230. })
  231. }
  232. that.search(that.tabs.active)
  233. },
  234. fail: function(err) {
  235. uni.navigateTo({
  236. url: `/pages/login/index`
  237. })
  238. }
  239. })
  240. },
  241. // 查询列表
  242. async search(active) {
  243. const that = this;
  244. let user = that.user;
  245. if (user._id) {
  246. let info = {
  247. skip: that.skip,
  248. limit: that.limit,
  249. }
  250. let res;
  251. if (active == '0') {
  252. info.customer = user._id;
  253. res = await that.$api(`/orderDetail`, 'GET', {
  254. ...info,
  255. ...that.searchInfo
  256. })
  257. if (res.errcode == '0') {
  258. let list = [...that.list, ...res.data];
  259. for (let val of list) {
  260. let status = that.ostatusList.find(i => i.value == val.status)
  261. if (status) val.zhStatus = status.label;
  262. }
  263. that.$set(that, `list`, list);
  264. that.$set(that, `total`, res.total)
  265. }
  266. } else if (active == '-1') {
  267. info.customer = user._id;
  268. res = await that.$api(`/afterSale`, 'GET', {
  269. ...info,
  270. ...that.searchInfo
  271. })
  272. if (res.errcode == '0') {
  273. let list = [...that.list, ...res.data];
  274. for (let val of list) {
  275. let type = that.typeList.find(i => i.value == val.type)
  276. if (type) val.zhType = type.label;
  277. let status = that.astatusList.find(i => i.value == val.status)
  278. if (status) val.zhStatus = status.label;
  279. val.url = val?.goods?.goods?.file;
  280. }
  281. that.$set(that, `list`, list);
  282. that.$set(that, `total`, res.total)
  283. }
  284. } else {
  285. info.leader = user._id;
  286. res = await that.$api(`/group`, 'GET', {
  287. ...info,
  288. ...that.searchInfo
  289. }, 'group')
  290. if (res.errcode == '0') {
  291. let list = [...that.list, ...res.data];
  292. for (let val of list) {
  293. let status = that.gstatusList.find(i => i.value == val.status)
  294. if (status) val.zhStatus = status.label;
  295. }
  296. that.$set(that, `list`, list);
  297. that.$set(that, `total`, res.total)
  298. }
  299. }
  300. }
  301. },
  302. // 分页
  303. toPage(e) {
  304. const that = this;
  305. let list = that.list;
  306. let limit = that.limit;
  307. if (that.total > list.length) {
  308. uni.showLoading({
  309. title: '加载中',
  310. mask: true
  311. })
  312. let page = that.page + 1;
  313. that.$set(that, `page`, page)
  314. let skip = page * limit;
  315. that.$set(that, `skip`, skip)
  316. that.search();
  317. uni.hideLoading();
  318. } else {}
  319. },
  320. // 输入框
  321. toInput(e) {
  322. const that = this;
  323. if (e.detail.value) that.$set(that.searchInfo, `name`, e.detail.value);
  324. that.clearPage();
  325. that.search();
  326. },
  327. // 选择选项卡
  328. tabsChange(e) {
  329. const that = this;
  330. that.$set(that.tabs, `active`, e.active)
  331. that.clearPage();
  332. that.search(e.active)
  333. },
  334. // 查询其他信息
  335. async searchOther() {
  336. const that = this;
  337. let res;
  338. // 查询状态
  339. res = await that.$api(`/dictData`, 'GET', {
  340. code: 'order_process'
  341. })
  342. if (res.errcode == '0') that.$set(that, `ostatusList`, res.data);
  343. res = await that.$api(`/dictData`, 'GET', {
  344. code: "afterSale_type"
  345. });
  346. if (res.errcode == '0') that.$set(that, `typeList`, res.data)
  347. res = await that.$api(`/dictData`, 'GET', {
  348. code: "afterSale_status"
  349. });
  350. if (res.errcode == '0') that.$set(that, `astatusList`, res.data)
  351. res = await that.$api(`/dictData`, 'GET', {
  352. code: "group_status"
  353. });
  354. if (res.errcode == '0') that.$set(that, `gstatusList`, res.data)
  355. },
  356. // 分享
  357. toShare(e) {
  358. const that = this;
  359. if (that.tabs.active == '1') {
  360. uni.navigateTo({
  361. url: `/pagesHome/group/share?id=${e.goods}`
  362. })
  363. that.clearPage();
  364. }
  365. },
  366. // 清空列表
  367. clearPage() {
  368. const that = this;
  369. that.$set(that, `list`, [])
  370. that.$set(that, `skip`, 0)
  371. that.$set(that, `limit`, 6)
  372. that.$set(that, `page`, 0)
  373. }
  374. }
  375. }
  376. </script>
  377. <style lang="scss">
  378. .main {
  379. display: flex;
  380. flex-direction: column;
  381. width: 100vw;
  382. height: 100vh;
  383. .one {
  384. position: relative;
  385. flex-grow: 1;
  386. padding: 2vw 0 0 0;
  387. .tabsList {
  388. position: relative;
  389. width: 100vw;
  390. height: 90vh;
  391. .one_1 {
  392. padding: 2vw;
  393. input {
  394. padding: 2vw;
  395. background-color: var(--f1Color);
  396. font-size: var(--font14Size);
  397. border-radius: 5px;
  398. }
  399. }
  400. .one_2 {
  401. .list {
  402. background-color: #fff;
  403. border: 1px solid var(--f5Color);
  404. padding: 2vw;
  405. margin: 0 2vw 2vw 2vw;
  406. border-radius: 5px;
  407. .list_1 {
  408. .list_1_1 {
  409. display: flex;
  410. justify-content: space-between;
  411. margin: 0 0 2vw 0;
  412. .shopname {
  413. text:last-child {
  414. padding: 0 0 0 2vw;
  415. }
  416. }
  417. .status {
  418. color: var(--ff0Color);
  419. }
  420. }
  421. .list_1_2 {
  422. border-bottom: 1px solid #f1f1f1;
  423. .goods {
  424. display: flex;
  425. padding: 0 0 2vw 0;
  426. .goods_1 {
  427. width: 20vw;
  428. height: 20vw;
  429. .image {
  430. width: 100%;
  431. height: 100%;
  432. border-radius: 5px;
  433. }
  434. }
  435. .goods_2 {
  436. width: 55vw;
  437. padding: 0 0 0 2vw;
  438. .goodsname {
  439. font-size: 16px;
  440. margin: 0 0 1vw 0;
  441. }
  442. .specs {
  443. font-size: 14px;
  444. color: #858585;
  445. }
  446. }
  447. .goods_3 {
  448. width: 15vw;
  449. text-align: right;
  450. .price {
  451. color: #ff0000;
  452. }
  453. }
  454. }
  455. }
  456. .other {
  457. padding: 0 0 2vw 0;
  458. margin: 2vw 0;
  459. text-align: right;
  460. border-bottom: 1px solid #f1f1f1;
  461. text {
  462. font-size: 14px;
  463. padding: 0 0 0 2vw;
  464. }
  465. }
  466. .btn {
  467. text-align: right;
  468. button {
  469. margin: 0 2vw 0 0;
  470. }
  471. }
  472. }
  473. .list_2 {
  474. .list_2_1 {
  475. display: flex;
  476. justify-content: space-between;
  477. font-size: var(--font16Size);
  478. margin: 0 0 2vw 0;
  479. .shopname {
  480. text {
  481. margin: 0 0 0 1vw;
  482. }
  483. }
  484. .type {
  485. color: var(--ff0Color);
  486. }
  487. }
  488. .list_2_2 {
  489. display: flex;
  490. justify-content: space-between;
  491. .image {
  492. width: 25vw;
  493. height: 25vw;
  494. margin: 0 2vw 1vw 0;
  495. border: 1px solid var(--f85Color);
  496. }
  497. .other {
  498. width: 65vw;
  499. flex-grow: 1;
  500. .name {
  501. font-size: var(--font16Size);
  502. }
  503. .other_1 {
  504. font-size: var(--font14Size);
  505. text {
  506. color: var(--f85Color);
  507. }
  508. }
  509. }
  510. }
  511. .btn {
  512. text-align: right;
  513. button {
  514. margin: 2vw 0 0 2vw;
  515. }
  516. }
  517. }
  518. }
  519. }
  520. }
  521. }
  522. }
  523. .scroll-view {
  524. position: absolute;
  525. top: 0;
  526. left: 0;
  527. right: 0;
  528. bottom: 0;
  529. .list-scroll-view {
  530. display: flex;
  531. flex-direction: column;
  532. }
  533. }
  534. </style>