handle.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <view class="one_1">
  6. <input type="text" v-model="searchInfo.customer_name" @input="toInput" placeholder="搜索购买者名称">
  7. </view>
  8. <view class="one_2">
  9. <button size="mini" @tap="toDislog">筛选</button>
  10. </view>
  11. </view>
  12. <view class="two">
  13. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
  14. <view class="list-scroll-view">
  15. <view class="list" v-for="(item,index) in list" :key="index">
  16. <view class="list_1">
  17. <view class="list_1_1">
  18. <view class="shopname">
  19. <text class="iconfont icon-shangdian"></text>
  20. <text>{{item.shop.name}}</text>
  21. </view>
  22. <view class="status">
  23. {{item.zhStatus||'暂无'}}
  24. </view>
  25. </view>
  26. <view class="list_1_2">
  27. <view class="goods">
  28. <view class="goods_1">
  29. <image class="image" v-if="item.spec.file&&item.spec.file.length>0"
  30. :src="item.spec.file&&item.spec.file.length>0?item.spec.file[0].url:''"
  31. mode=""></image>
  32. <image class="image" v-else
  33. :src="item.goods.file&&item.goods.file.length>0?item.goods.file[0].url:''"
  34. mode=""></image>
  35. </view>
  36. <view class="goods_2">
  37. <view class="goodsname textOver">
  38. {{item.goods.name}}
  39. </view>
  40. <view class="specs">
  41. {{item.spec.name}}
  42. </view>
  43. <view class="time">
  44. 购买者:{{item.customer.name}}
  45. </view>
  46. <view class="time">
  47. 购买时间:{{item.buy_time}}
  48. </view>
  49. </view>
  50. <view class="goods_3">
  51. <view class="price">
  52. ¥{{item.spec.price||0}}
  53. </view>
  54. <view class="num">
  55. ×{{item.num||0}}
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="other">
  61. <text>共{{item.num||0}}件商品</text>
  62. <text>实付款¥{{item.pay}}</text>
  63. </view>
  64. </view>
  65. <view class="btn">
  66. <button type="default" size="mini" @tap.stop="toView(item,'order')">详细信息</button>
  67. <button v-if="item.status=='2'||item.status=='3'||item.status=='2-'" size="mini"
  68. @tap.stop="toLogi(item)">查看物流</button>
  69. <button v-if="item.is_afterSale==true" size="mini" @tap.stop="toHandle(item)">售后处理</button>
  70. </view>
  71. </view>
  72. <view class="is_bottom" v-if="is_bottom">
  73. <text>{{config.bottom_title}}</text>
  74. </view>
  75. </view>
  76. </scroll-view>
  77. </view>
  78. <view class="dialog" v-if="dialog.show==true">
  79. <view class="dialog_1" v-if="dialog.type=='1'">
  80. <uni-forms ref="form" :modelValue="searchInfo" :rules="rules" label-width="auto">
  81. <uni-forms-item label="状态" name="status">
  82. <picker class="picker" mode="selector" :range="statusList" @change="statusChange"
  83. range-key="label">
  84. <view>{{status_name||'请选择状态'}}</view>
  85. </picker>
  86. </uni-forms-item>
  87. </uni-forms>
  88. <view class="btn">
  89. <button type="primary" @click="onSubmit" size="mini">确定</button>
  90. <button type="primary" @click="dialogClose" size="mini">取消</button>
  91. </view>
  92. </view>
  93. <view class="dialog_1" v-else-if="dialog.type=='2'">
  94. <uni-forms ref="form" :modelValue="afterInfo" :rules="rules" label-width="auto">
  95. <uni-forms-item label="售后类型" name="zhType">
  96. <uni-easyinput disabled type="text" v-model="afterInfo.zhType" placeholder="请输入售后类型" />
  97. </uni-forms-item>
  98. <uni-forms-item label="售后状态" name="zhStatus">
  99. <uni-easyinput disabled type="text" v-model="afterInfo.zhStatus" placeholder="请输入售后状态" />
  100. </uni-forms-item>
  101. <uni-forms-item label="申请理由" name="zhReason">
  102. <uni-easyinput disabled type="text" v-model="afterInfo.zhReason" placeholder="请输入申请理由" />
  103. </uni-forms-item>
  104. <uni-forms-item label="退款金额" name="money">
  105. <uni-easyinput disabled type="text" v-model="afterInfo.money" placeholder="请输入退款金额" />
  106. </uni-forms-item>
  107. <uni-forms-item label="售后申请时间" name="apply_time">
  108. <uni-easyinput disabled type="text" v-model="afterInfo.apply_time" placeholder="请输入售后申请时间" />
  109. </uni-forms-item>
  110. <uni-forms-item label="申请售后描述" name="desc">
  111. <uni-easyinput disabled type="textarea" v-model="afterInfo.desc" placeholder="请输入申请售后描述" />
  112. </uni-forms-item>
  113. </uni-forms>
  114. <view class="btn">
  115. <button type="primary" @click="toAgree(true)" size="mini">同意</button>
  116. <button type="primary" @click="toAgree(false)" size="mini">不同意</button>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. </mobile-frame>
  122. </template>
  123. <script>
  124. export default {
  125. data() {
  126. return {
  127. // 系统设置
  128. config: {},
  129. // 设备信息
  130. system: {},
  131. user: {},
  132. id: '',
  133. searchInfo: {},
  134. list: [],
  135. afterInfo:{},
  136. total: 0,
  137. skip: 0,
  138. limit: 6,
  139. page: 0,
  140. // 数据是否触底
  141. is_bottom: false,
  142. scrollTop: 0,
  143. // 字典表
  144. statusList: [],
  145. // 售后类型
  146. typeList:[],
  147. // 售后状态
  148. astatusList:[],
  149. // 理由
  150. reasonList:[],
  151. status_name: "",
  152. // 条件弹出框
  153. dialog: {
  154. show: false,
  155. type: '1'
  156. }
  157. };
  158. },
  159. onLoad: function(e) {
  160. const that = this;
  161. that.$set(that, `id`, e.id || '');
  162. that.searchConfig();
  163. },
  164. onShow: async function(e) {
  165. const that = this;
  166. await that.searchOther();
  167. await that.watchlogin();
  168. },
  169. onPullDownRefresh: async function() {
  170. const that = this;
  171. that.clearPage();
  172. await that.search();
  173. uni.stopPullDownRefresh();
  174. },
  175. methods: {
  176. // 查询基本设置
  177. searchConfig() {
  178. const that = this;
  179. uni.getStorage({
  180. key: 'config',
  181. success: function(res) {
  182. if (res.data) that.$set(that, `config`, res.data)
  183. // 设备平台信息
  184. let config = that.$config;
  185. that.$set(that, `system`, config.system);
  186. },
  187. fail: function(err) {
  188. console.log(err);
  189. }
  190. })
  191. },
  192. // 监听用户是否登录
  193. watchlogin() {
  194. const that = this;
  195. uni.getStorage({
  196. key: 'token',
  197. success: function(res) {
  198. let user = that.$jwt(res.data);
  199. if (user) {
  200. that.$set(that, `user`, user)
  201. that.search();
  202. }
  203. }
  204. })
  205. },
  206. async search() {
  207. const that = this;
  208. let info = {
  209. skip: that.skip,
  210. limit: that.limit,
  211. group: that.id
  212. }
  213. let res = await that.$api(`/groupOrder/userView`, 'GET', {
  214. ...info,
  215. ...that.searchInfo
  216. }, 'group');
  217. if (res.errcode == '0') {
  218. let list = [...that.list, ...res.data];
  219. for (let val of list) {
  220. if (val.status) val.zhStatus = that.searchStatus(val.status)
  221. }
  222. that.$set(that, `list`, list);
  223. that.$set(that, `total`, res.total)
  224. } else {
  225. uni.showToast({
  226. title: res.errmsg,
  227. icon: 'none'
  228. })
  229. }
  230. },
  231. // 查询状态
  232. searchStatus(e) {
  233. const that = this;
  234. let data = that.statusList.find((i) => i.value == e);
  235. if (data) return data.label
  236. else return '暂无'
  237. },
  238. // 订单详细信息
  239. toView(item) {
  240. const that = this;
  241. that.clearPage();
  242. uni.navigateTo({
  243. url: `/pagesMy/dough/info?id=${item._id}`
  244. })
  245. },
  246. // 分页
  247. toPage(e) {
  248. const that = this;
  249. let list = that.list;
  250. let limit = that.limit;
  251. if (that.total > list.length) {
  252. uni.showLoading({
  253. title: '加载中',
  254. mask: true
  255. })
  256. let page = that.page + 1;
  257. that.$set(that, `page`, page)
  258. let skip = page * limit;
  259. that.$set(that, `skip`, skip)
  260. that.search();
  261. uni.hideLoading();
  262. } else that.$set(that, `is_bottom`, true)
  263. },
  264. toScroll(e) {
  265. const that = this;
  266. let up = that.scrollTop;
  267. that.$set(that, `scrollTop`, e.detail.scrollTop);
  268. let num = Math.sign(up - e.detail.scrollTop);
  269. if (num == 1) that.$set(that, `is_bottom`, false);
  270. },
  271. // 查询条件
  272. toDislog() {
  273. const that = this;
  274. that.$set(that, `searchInfo`, {})
  275. that.$set(that, `status_name`, '')
  276. that.$set(that, `dialog`, {
  277. show: true,
  278. type: '1'
  279. })
  280. },
  281. // 售后处理
  282. async toHandle(e){
  283. const that = this;
  284. let res = await that.$api(`/groupAfterSale`, 'GET', {
  285. order:e._id,
  286. customer:e.customer._id
  287. }, 'group')
  288. if (res.errcode == '0') {
  289. for (let val of res.data) {
  290. let type = that.typeList.find(i => i.value == val.type)
  291. if (type) val.zhType = type.label;
  292. let status = that.astatusList.find(i => i.value == val.status)
  293. if (status) val.zhStatus = status.label;
  294. let reason = that.reasonList.find(i => i.value == val.reason)
  295. if (reason) val.zhReason = reason.label;
  296. }
  297. that.$set(that, `afterInfo`, res.data[0]);
  298. }
  299. that.$set(that, `dialog`, {
  300. show: true,
  301. type: '2'
  302. })
  303. },
  304. // 售后同意
  305. async toAgree(e){
  306. const that = this;
  307. uni.showModal({
  308. title: '提示',
  309. content: '确定处理该订单吗?',
  310. success: async function(res) {
  311. if (res.confirm) {
  312. let arr = await that.$api(`/groupAfterSale/${that.afterInfo._id}`, 'POST', {
  313. leader_suggest: e
  314. }, 'group')
  315. if (arr.errcode == '0') {
  316. uni.showToast({
  317. title: '处理完成',
  318. icon: 'none'
  319. })
  320. that.$set(that, `dialog`, {
  321. show: false,
  322. type: '2'
  323. })
  324. that.$set(that, `afterInfo`, {})
  325. that.clearPage();
  326. that.search();
  327. } else {
  328. uni.showToast({
  329. title: arr.errmsg,
  330. icon: 'none'
  331. })
  332. that.$set(that, `dialog`, {
  333. show: false,
  334. type: '2'
  335. })
  336. that.$set(that, `afterInfo`, {})
  337. that.clearPage();
  338. that.search();
  339. }
  340. }
  341. }
  342. });
  343. },
  344. // 状态选择
  345. statusChange(e) {
  346. const that = this;
  347. let data = that.statusList[e.detail.value];
  348. if (data) {
  349. that.$set(that.searchInfo, `status`, data.value);
  350. that.$set(that, `status_name`, data.label);
  351. }
  352. },
  353. // 关闭弹框
  354. dialogClose() {
  355. const that = this;
  356. that.clearPage();
  357. that.search();
  358. that.$set(that, `dialog`, {
  359. show: false,
  360. type: '1'
  361. })
  362. },
  363. // 查询
  364. onSubmit() {
  365. const that = this;
  366. that.clearPage();
  367. that.search();
  368. that.$set(that, `dialog`, {
  369. show: false,
  370. type: '1'
  371. })
  372. },
  373. // 查看物流
  374. toLogi(e) {
  375. const that = this;
  376. that.clearPage();
  377. uni.navigateTo({
  378. url: `/pagesMy/logistics/index?id=${e._id}&type=${'groupOrder'}`
  379. })
  380. },
  381. // 查询其他信息
  382. async searchOther() {
  383. const that = this;
  384. let res;
  385. // 查询状态
  386. res = await that.$api(`/dictData`, 'GET', {
  387. code: 'order_process'
  388. })
  389. if (res.errcode == '0') that.$set(that, `statusList`, res.data);
  390. res = await that.$api(`/dictData`, 'GET', {
  391. code: "afterSale_type"
  392. });
  393. if (res.errcode == '0') that.$set(that, `typeList`, res.data)
  394. res = await that.$api(`/dictData`, 'GET', {
  395. code: "afterSale_status"
  396. });
  397. if (res.errcode == '0') that.$set(that, `astatusList`, res.data)
  398. res = await that.$api(`/dictData`, 'GET', {
  399. code: "afterSale_reason"
  400. });
  401. if (res.errcode == '0') that.$set(that, `reasonList`, res.data)
  402. },
  403. // 输入框
  404. toInput(e) {
  405. const that = this;
  406. if (that.searchInfo.customer_name) that.$set(that.searchInfo, `customer_name`, e.detail.value)
  407. else that.$set(that, `searchInfo`, {})
  408. that.clearPage();
  409. that.search();
  410. },
  411. // 清空列表
  412. clearPage() {
  413. const that = this;
  414. that.$set(that, `list`, [])
  415. that.$set(that, `skip`, 0)
  416. that.$set(that, `limit`, 6)
  417. that.$set(that, `page`, 0)
  418. }
  419. },
  420. }
  421. </script>
  422. <style lang="scss">
  423. .main {
  424. display: flex;
  425. flex-direction: column;
  426. width: 100vw;
  427. height: 100vh;
  428. .one {
  429. display: flex;
  430. justify-content: center;
  431. align-items: center;
  432. padding: 2vw;
  433. .one_1 {
  434. padding: 0 2vw;
  435. width: 75vw;
  436. input {
  437. padding: 2vw;
  438. background-color: var(--f1Color);
  439. font-size: var(--font14Size);
  440. border-radius: 5px;
  441. }
  442. }
  443. button {
  444. background-color: #23B67A;
  445. color: #ffffff;
  446. }
  447. }
  448. .two {
  449. position: relative;
  450. flex-grow: 1;
  451. background-color: var(--f9Color);
  452. .list {
  453. background-color: #fff;
  454. border: 1px solid var(--f5Color);
  455. padding: 2vw;
  456. margin: 0 2vw 2vw 2vw;
  457. border-radius: 5px;
  458. .list_1 {
  459. .list_1_1 {
  460. display: flex;
  461. justify-content: space-between;
  462. margin: 0 0 2vw 0;
  463. .shopname {
  464. text:last-child {
  465. padding: 0 0 0 2vw;
  466. }
  467. }
  468. .status {
  469. color: var(--fFB1Color);
  470. }
  471. }
  472. .list_1_2 {
  473. border-bottom: 1px solid #f1f1f1;
  474. .goods {
  475. display: flex;
  476. padding: 0 0 2vw 0;
  477. .goods_1 {
  478. width: 20vw;
  479. height: 20vw;
  480. .image {
  481. width: 100%;
  482. height: 100%;
  483. border-radius: 5px;
  484. }
  485. }
  486. .goods_2 {
  487. width: 55vw;
  488. padding: 0 0 0 2vw;
  489. .goodsname {
  490. font-size: 16px;
  491. margin: 0 0 1vw 0;
  492. }
  493. .specs {
  494. font-size: 14px;
  495. color: #858585;
  496. }
  497. .time {
  498. font-size: 13px;
  499. color: #858585;
  500. }
  501. }
  502. .goods_3 {
  503. width: 15vw;
  504. text-align: right;
  505. .price {
  506. color: var(--fFB1Color);
  507. }
  508. }
  509. }
  510. }
  511. .other {
  512. padding: 0 0 2vw 0;
  513. margin: 2vw 0;
  514. text-align: right;
  515. border-bottom: 1px solid #f1f1f1;
  516. text {
  517. font-size: 14px;
  518. padding: 0 0 0 2vw;
  519. }
  520. }
  521. }
  522. .btn {
  523. text-align: right;
  524. button {
  525. margin: 0 1vw 0 0;
  526. }
  527. }
  528. }
  529. }
  530. }
  531. .dialog {
  532. position: fixed;
  533. width: 96vw;
  534. height: 100vh;
  535. background-color: #ffffff;
  536. z-index: 99999;
  537. display: flex;
  538. flex-direction: column;
  539. padding: 2vw;
  540. .uni-input {
  541. border: #f1f1ff 1px solid;
  542. padding: 2vw 2vw;
  543. border-radius: 1vw;
  544. }
  545. .picker {
  546. border: 1px solid #3333;
  547. border-radius: 5px;
  548. padding: 2vw;
  549. }
  550. .btn {
  551. text-align: center;
  552. button {
  553. margin: 0 2vw 2vw 2vw;
  554. background-color: #23B67A;
  555. color: #ffffff;
  556. }
  557. .name {
  558. color: var(--f85Color);
  559. font-size: var(--font14Size);
  560. }
  561. }
  562. }
  563. .scroll-view {
  564. position: absolute;
  565. top: 0;
  566. left: 0;
  567. right: 0;
  568. bottom: 0;
  569. .list-scroll-view {
  570. display: flex;
  571. flex-direction: column;
  572. }
  573. }
  574. .is_bottom {
  575. text-align: center;
  576. text {
  577. padding: 2vw 0;
  578. display: inline-block;
  579. color: #858585;
  580. font-size: 14px;
  581. }
  582. }
  583. </style>