order.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <template>
  2. <view class="page-container">
  3. <webviewPoint ref="webviewRef"/>
  4. <z-paging ref="paging" v-model="dataList"
  5. :paging-style="{
  6. background: 'linear-gradient(180deg, #C1FFF8 0%, #B8FFF3 34%, #F5FFFF 100%)'
  7. }" @query="queryList">
  8. <template #top>
  9. <view class="tab-box">
  10. <view v-for="(item,index) in statusList" :key="index"
  11. :class="{ item: true, active: current === index }"
  12. @click="onTabChange(item.code, index)">
  13. {{item.info}}
  14. </view>
  15. </view>
  16. </template>
  17. <view class="list-box" v-if="dataList && dataList.length > 0">
  18. <view class="item" v-for="(item,index) in dataList" :key="index">
  19. <view class="lTitle" @click="goDetails(item.cId)">
  20. <view style="font-weight: bold;">上门时间:{{item.dtCreateTime}}</view>
  21. <!-- <view class="status">{{item.nStatus === 0 ? "待接单" : item.nStatus === 1 ? "服务中": item.nStatus === 2 ? "待评价": item.nStatus === 3 ? "已完成": item.nStatus === -1 ? "待付款" : item.nStatus === -2 ? "已取消" :'已拒绝'}}</view>-->
  22. <view class="status" :style="{color:item.statusName ==='已取消'?'#999':''}">{{item.statusName}}</view>
  23. </view>
  24. <view class="cont" @click="goDetails(item.cId)">
  25. <!-- <view>商家:{{item.js.cNickName}}</view> -->
  26. <view>项目:{{item.cGoods ? item.cGoods[0].cTitle : ''}}</view>
  27. </view>
  28. <!-- <view class="cont" @click="goDetails(item.cId)">
  29. <view>订单金额:</view>
  30. <view style="color: #333;font-weight: bold;">¥{{item.totalPrice}}</view>
  31. </view> -->
  32. <view class="cont" @click="goDetails(item.cId)">
  33. <view>下单时间:{{item.dtCreateTime}}</view>
  34. <!-- <view style="color: #333;font-weight: bold;">¥{{item.totalPrice}}</view> -->
  35. </view>
  36. <view class="btn">
  37. <view class="count_down">
  38. <text>¥</text>{{item.totalPrice}}
  39. <!-- 剩余<u-count-down :time="item.remainingTime" @finish="" v-if="item.dtCreateTime>0"></u-count-down> -->
  40. </view>
  41. <view class="button">
  42. <text class="pay" @click="onCancleOrder(item)" v-if="[0, 1, 2, 3, 6].includes(item.nStatus)">取消订单</text>
  43. <text class="pay" @click="onCancleApply(item)" v-if="item.nStatus == 7">取消申请</text>
  44. <text class="pay" @click="onPayOrder(item)" v-if="item.nStatus == -1 && item.nStatus < 1">支付订单</text>
  45. <text class="pay" @click="goEvaluate(item)" v-if="item.nStatus == 4">去评价</text>
  46. <text class="pay" @click="onDelOrder(item)" v-if="item.nStatus <= -2 || item.nStatus == 5">删除订单</text>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <template v-slot:empty>
  52. <u-empty
  53. :text="!isLogin ? '您还没有登录' : '您还没有相关订单呦~'"
  54. icon="/static/common/logo1.png"
  55. >
  56. <u-button
  57. size="small"
  58. text="去登录"
  59. color="linear-gradient(to right, #35c99d, #27aea7)"
  60. :customStyle="{ marginTop: '20rpx' }"
  61. v-if="!isLogin"
  62. @click="goLogin"
  63. >
  64. </u-button>
  65. </u-empty>
  66. </template>
  67. </z-paging>
  68. <!-- 取消订单弹窗 -->
  69. <u-popup :show="cancelOrderPopup.show" mode="center" :width="700" :round="10" closeable @close="closePopup">
  70. <view class="popup-content">
  71. <view v-if="cancelOrderPopup.isOk" class="success-tip">{{ cancelOrderPopup.successTip }}</view>
  72. <view v-else>
  73. <uni-table border stripe>
  74. <uni-tr class="table-header">
  75. <uni-th width="200rpx" align="center">项目</uni-th>
  76. <uni-th width="150rpx" align="center">实付金额</uni-th>
  77. <uni-th width="180rpx" align="center">已服务时间</uni-th>
  78. </uni-tr>
  79. <uni-tr v-for="(item, index) in cancelOrderPopup.orderList" :key="index">
  80. <uni-td align="center"> {{ item.cTitle }} </uni-td>
  81. <uni-td align="center"> {{ item.dYuanPrice }} </uni-td>
  82. <uni-td align="center"> {{ item.serviceDuration }} </uni-td>
  83. </uni-tr>
  84. </uni-table>
  85. <u--textarea v-model="cancelOrderPopup.reason" placeholder="请输入退单原因" count maxlength="50" class="reson"></u--textarea>
  86. </view>
  87. <view v-if="!cancelOrderPopup.isOk" class="popup-btn">
  88. <u-button size="small" plain shape="circle" text="取消" style="margin-right: 50rpx;" @click="closePopup"></u-button>
  89. <u-button size="small" shape="circle" type="error" text="提交申请" @click="onSubmitApply"></u-button>
  90. </view>
  91. <view class="popup-btn">
  92. <u-button v-if="cancelOrderPopup.isOk" size="small" shape="circle" color="linear-gradient(135deg, #1AD8CF 0%, #21C8C0 100%)" text="确认" @click="closePopup"></u-button>
  93. </view>
  94. </view>
  95. </u-popup>
  96. </view>
  97. </template>
  98. <script>
  99. import {
  100. getIsLottery,
  101. getStatusList,
  102. } from '@/api/index.js';
  103. import {
  104. delOrder,
  105. cancleOrder,
  106. cancleApply,
  107. orderDeatails,
  108. } from '@/api/order.js';
  109. import webviewPoint from "@/components/webviewPoint.vue";
  110. export default {
  111. components: { webviewPoint },
  112. data() {
  113. return {
  114. dataList: [],
  115. current: 0,
  116. statusList: [],
  117. nStatus: '',
  118. isLogin: false,
  119. // 取消订单
  120. cancelOrderPopup: {
  121. show: false, // 弹窗显示状态
  122. isOk: false, // 是否确认
  123. successTip: '您的申请已提交,客服审核中,请注意接听客服电话:19936963696',
  124. orderList: [],
  125. orderInfo: null, // 当前要取消的订单信息
  126. cId: '', // 订单ID
  127. reason: '' // 用户输入的取消原因
  128. }
  129. }
  130. },
  131. onLoad(query) {
  132. this.isLogin = !!uni.getStorageSync('wx_copenid');
  133. },
  134. onShow() {
  135. var _this = this;
  136. getIsLottery({types:[1,3]}).then(res=>{
  137. if(res.data.data?.isLottery === 1){
  138. _this.$refs.webviewRef?.getRow(res.data.data);
  139. }
  140. })
  141. this.getStatus()
  142. },
  143. methods: {
  144. queryList(pageNo, pageSize) {
  145. let params = {
  146. current: pageNo,
  147. size: pageSize,
  148. cOpenId: uni.getStorageSync('wx_copenid'),
  149. nStatus: this.nStatus,
  150. }
  151. orderDeatails(params).then(res => {
  152. if (res.data.code === 200) {
  153. this.dataList = res.data.data.records;
  154. // let data = res.data.data.records.forEach(item => {
  155. // item.dtCreateTime = item.dtCreateTime.replace('T', ' ')
  156. // });
  157. this.$refs.paging.complete(this.dataList);
  158. } else {
  159. this.$refs.paging.complete([]);
  160. }
  161. });
  162. },
  163. onPayOrder(item) {
  164. if (item.remainingTime <= 0) {
  165. uni.showToast({
  166. title: '订单已超时',
  167. icon: 'none'
  168. })
  169. } else {
  170. let str = uni.$u.queryParams({
  171. page: 'order',
  172. orderNo: item.orderNo
  173. });
  174. uni.navigateTo({
  175. url: `/pages/identify/pay_order${str}`
  176. })
  177. }
  178. },
  179. // 取消退单申请
  180. onCancleApply(item) {
  181. uni.showModal({
  182. title: '提示',
  183. content: '确定取消退单申请吗?',
  184. showCancel: true,
  185. success: (res) => {
  186. if (res.confirm) {
  187. let params = {
  188. cId: item.cId
  189. }
  190. cancleApply(params).then(res => {
  191. if (res.data.code == 200) {
  192. this.$refs.paging.reload();
  193. uni.showToast({
  194. title: '已取消',
  195. icon: 'none'
  196. })
  197. } else {
  198. uni.showToast({
  199. title: res.data.msg,
  200. icon: 'none'
  201. })
  202. }
  203. })
  204. }
  205. }
  206. })
  207. },
  208. // 取消订单
  209. onCancleOrder(item) {
  210. this.cancelOrderPopup.cId = item.cId
  211. this.cancelOrderPopup.orderList = item.cGoods || []
  212. this.cancelOrderPopup.show = true;
  213. },
  214. // 提交退单申请
  215. onSubmitApply() {
  216. if (this.cancelOrderPopup.reason === '') {
  217. uni.showToast({
  218. title: '请输入退单原因',
  219. icon: 'none'
  220. })
  221. return
  222. }
  223. let params = {
  224. cId: this.cancelOrderPopup.cId,
  225. cancelReason: this.cancelOrderPopup.reason
  226. }
  227. cancleOrder(params).then(res => {
  228. if (res.data.code == 200) {
  229. this.cancelOrderPopup.isOk = true
  230. this.$refs.paging.reload();
  231. } else {
  232. uni.showToast({
  233. title: res.data.msg,
  234. icon: 'none'
  235. })
  236. }
  237. })
  238. },
  239. // 关闭弹窗
  240. closePopup() {
  241. this.cancelOrderPopup.show = false;
  242. this.cancelOrderPopup.isOk = false;
  243. this.cancelOrderPopup.reason = '';
  244. },
  245. // 删除订单
  246. onDelOrder(item) {
  247. uni.showModal({
  248. title: '提示',
  249. content: '确定删除订单吗?',
  250. showCancel: true, // 是否显示取消按钮
  251. success: (res) => {
  252. if (res.confirm) {
  253. let params = {
  254. cId: item.cId
  255. }
  256. delOrder(params).then(res => {
  257. if (res.data.code == 200) {
  258. this.$refs.paging.reload();
  259. uni.showToast({
  260. title: '删除订单成功!',
  261. icon: 'none'
  262. })
  263. } else {
  264. uni.showToast({
  265. title: res.data.msg,
  266. icon: 'none'
  267. })
  268. }
  269. })
  270. }
  271. }
  272. })
  273. },
  274. getStatus() {
  275. getStatusList().then(res => {
  276. this.statusList = res.data.data,
  277. this.nStatus = '';
  278. // 判断其它页面跳转过来
  279. let orderTab = this.$store.state.other.orderTab;
  280. if (orderTab !== '') {
  281. let i = this.statusList.findIndex(item => item.code === orderTab);
  282. // 请求数据
  283. this.onTabChange(orderTab, i);
  284. // 赋值完成后清除
  285. this.$store.dispatch('setOrderTab', '');
  286. }
  287. });
  288. },
  289. // 切换订单
  290. onTabChange(code, index) {
  291. this.current = index;
  292. this.nStatus = code;
  293. this.$refs.paging.reload();
  294. },
  295. // 跳转订单详情
  296. goDetails(cid) {
  297. let str = uni.$u.queryParams({
  298. cid
  299. });
  300. uni.navigateTo({
  301. url: `/pages/order/order_detail${str}`
  302. });
  303. },
  304. goEvaluate(item) {
  305. console.log(item)
  306. let str = uni.$u.queryParams({
  307. orderNo: item.orderNo,
  308. cId: item.cId,
  309. cJsId: item.cJsId,
  310. cName: item.js.cName,
  311. nickName:item.wxUser.nickName
  312. });
  313. uni.navigateTo({
  314. url: `/pages/order/comment${str}`
  315. });
  316. },
  317. goLogin() {
  318. uni.navigateTo({
  319. url: '/setting/myNew/phone',
  320. })
  321. // uni.navigateTo({
  322. // url: '/pages/login/wxLogin'
  323. // })
  324. },
  325. },
  326. }
  327. </script>
  328. <style scoped lang="scss">
  329. .page-container {
  330. background: linear-gradient(180deg, #C1FFF8 0%, #B8FFF3 34%, #F5FFFF 100%);
  331. .tab-box {
  332. height: 90rpx;
  333. display: flex;
  334. justify-content: space-around;
  335. align-items: center;
  336. font-size: 30rpx;
  337. z-index: 999;
  338. background: radial-gradient(circle, #fcfdff, #fcfdff);
  339. .item {
  340. height: 100%;
  341. padding: 0 10rpx;
  342. background-color: #fff;
  343. display: flex;
  344. align-items: center;
  345. }
  346. .active {
  347. font-weight: 400;
  348. font-size: 30rpx;
  349. color: #03C8BE;
  350. position: relative;
  351. &::after{
  352. content: '';
  353. width: 36rpx;
  354. height: 4rpx;
  355. position: absolute;
  356. bottom: 0;
  357. left: 50%;
  358. transform: translateX(-50%);
  359. background-color: #03C8BE;
  360. }
  361. }
  362. }
  363. .list-box {
  364. flex: 1;
  365. padding: 32rpx;
  366. .item {
  367. width: 100%;
  368. padding: 24rpx 32rpx;
  369. margin-bottom: 10rpx;
  370. font-size: 28rpx;
  371. margin-bottom: 28rpx;
  372. box-sizing: border-box;
  373. background: #FFFFFF;
  374. box-shadow: 0px 4px 12px 0px rgba(88, 209, 187, 0.1);
  375. border-radius: 24px 24px 24px 24px;
  376. .lTitle {
  377. display: flex;
  378. justify-content: space-between;
  379. border-bottom: 1px solid #eeeeee;
  380. margin-bottom: 10rpx;
  381. padding-bottom: 20rpx;
  382. font-size: 28rpx;
  383. .status {
  384. color: #03C8BE;
  385. }
  386. }
  387. .cont {
  388. color: rgb(162, 162, 162);
  389. font-size: 26rpx;
  390. line-height: 45rpx;
  391. }
  392. .btn {
  393. height: 48rpx;
  394. margin-top: 20rpx;
  395. display: flex;
  396. align-items: center;
  397. justify-content: space-between;
  398. .count_down {
  399. font-size: 26rpx;
  400. color: #F53E54;
  401. text {
  402. font-size: 20rpx;
  403. }
  404. }
  405. .button {
  406. .pay {
  407. display: inline-block;
  408. background-color: rgb(46, 188, 215);
  409. color: #fff;
  410. margin-left: 20rpx;
  411. padding: 0rpx 30rpx;
  412. height: 48rpx;
  413. line-height: 48rpx;
  414. background: linear-gradient(135deg, #1AD8CF 0%, #21C8C0 100%);
  415. border-radius: 98rpx 98rpx 98rpx 98rpx;
  416. }
  417. .cancel {
  418. width: 152rpx;
  419. height: 48rpx;
  420. border-radius: 98rpx;
  421. border: 2rpx solid #BBBBBB;
  422. padding: 5rpx 30rpx;
  423. }
  424. }
  425. }
  426. }
  427. }
  428. .popup-content {
  429. width: 90vw;
  430. padding: 100rpx 30rpx 30rpx;
  431. box-sizing: border-box;
  432. .table-header {
  433. background-color: #FBFBFB;
  434. }
  435. .success-tip {
  436. padding: 50rpx;
  437. font-size: 32rpx;
  438. text-align: center;
  439. margin-bottom: 30rpx;
  440. }
  441. .reson {
  442. margin: 30rpx;
  443. }
  444. .popup-btn {
  445. padding: 0 80rpx;
  446. display: flex;
  447. justify-content: space-between;
  448. }
  449. }
  450. }
  451. </style>