order.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <view class="order">
  3. <view class="top">
  4. <view v-for="(item,index) in status" :key="index" :class="checkedIndex === index ? 'active' : '' "
  5. @click="statusTap(item.code,index)">
  6. {{item.info}}
  7. </view>
  8. </view>
  9. <!-- <view class="list" v-if="isLogin"> -->
  10. <mescroll-uni class="list" :fixed="false" ref="mescrollRef" @up="getList" @init="mescrollInit" v-if="isLogin">
  11. <view class="item" v-for="(item,index) in list" :key="index">
  12. <view class="lTitle" @click="goDetails(item.cId)">
  13. <view style="font-weight: bold;">上门时间:{{item.dtCreateTime}}</view>
  14. <!-- <view class="status">{{item.nStatus === 0 ? "待接单" : item.nStatus === 1 ? "服务中": item.nStatus === 2 ? "待评价": item.nStatus === 3 ? "已完成": item.nStatus === -1 ? "待付款" : item.nStatus === -2 ? "已取消" :'已拒绝'}}</view>-->
  15. <view class="status" :style="{color:item.statusName ==='已取消'?'#999':''}">{{item.statusName}}</view>
  16. </view>
  17. <view class="cont" @click="goDetails(item.cId)">
  18. <view>商家:{{item.js.cNickName}}</view>
  19. <view>项目:{{item.cGoods[0].cTitle}}</view>
  20. </view>
  21. <!-- <view class="cont" @click="goDetails(item.cId)">
  22. <view>订单金额:</view>
  23. <view style="color: #333;font-weight: bold;">¥{{item.totalPrice}}</view>
  24. </view> -->
  25. <view class="cont" @click="goDetails(item.cId)">
  26. <view>下单时间:{{item.dtCreateTime}}</view>
  27. <!-- <view style="color: #333;font-weight: bold;">¥{{item.totalPrice}}</view> -->
  28. </view>
  29. <!-- <view class="btn" v-if="item.nStatus < 1"> -->
  30. <view class="btn">
  31. <view class="count_down">
  32. <span>¥</span>{{item.totalPrice}}
  33. <!-- 剩余<u-count-down :timestamp="item.remainingTime" @end="getList" v-if="item.dtCreateTime>0"></u-count-down> -->
  34. </view>
  35. <view class="button">
  36. <text class="cancel" @click="cancle(item.cId)" v-if="item.nStatus > -2 && item.nStatus < 1">取消订单</text>
  37. <text class="pay" @click="nowYuyue(item,item.cId,item.dTotalMoney,item.remainingTime)"
  38. v-if="item.nStatus == -1 && item.nStatus < 1 ">支付订单</text>
  39. <text class="pay" @click="goEvaluate(item)" v-if="item.nStatus == 4">去评价</text>
  40. <text class="pay" @click="deleteOrder(item.cId)" v-if="item.nStatus <= -2 || item.nStatus == 5">删除订单</text>
  41. </view>
  42. </view>
  43. <!-- <view class="btn" v-if="item.nStatus <= -2 || item.nStatus == 5">
  44. <text @click="deleteOrder(item.cId)">删除订单</text>
  45. </view> -->
  46. </view>
  47. </mescroll-uni>
  48. <!-- </view> -->
  49. <view class="login" v-else>
  50. <text>您还没有登录</text>
  51. <view class="login_btn" @click="goLogin">
  52. 去登录
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  59. import {
  60. statusList,
  61. cancleOrder,
  62. orderDeatails,
  63. delOrder,
  64. getInfo,
  65. payoff
  66. } from '../../api/index.js'
  67. export default {
  68. mixins: [MescrollMixin], // 使用mixin
  69. data() {
  70. return {
  71. timeStamp: 90,
  72. status: [],
  73. checkedIndex: 0,
  74. list: [],
  75. nStatus: '',
  76. money: 0,
  77. dTotalMoney: 0,
  78. isLogin: false,
  79. current: 1
  80. }
  81. },
  82. methods: {
  83. goEvaluate(item) {
  84. uni.navigateTo({
  85. url: './comment?orderNo=' + item.orderNo + '&cJsId=' + item.cJsId + '&cId=' + item.cId + '&cName=' + item
  86. .js.cName
  87. })
  88. },
  89. nowYuyue(item, cId, dTotalMoney, remainingTime) {
  90. if (remainingTime == 0) {
  91. uni.showToast({
  92. title: '订单已超时',
  93. icon: 'none'
  94. })
  95. } else {
  96. uni.navigateTo({
  97. url: '/pages/identify/pay_order?orderNo=' + item.orderNo + '&page=' + 'order'
  98. })
  99. }
  100. },
  101. goLogin() {
  102. uni.navigateTo({
  103. url: '../login/wxLogin'
  104. })
  105. },
  106. // 取消订单
  107. cancle(cId) {
  108. var id = {
  109. cId: cId
  110. }
  111. cancleOrder(id).then(res => {
  112. if (res.data.code == 200) {
  113. uni.showToast({
  114. title: '已取消',
  115. icon: 'none'
  116. })
  117. this.$router.go(0)
  118. // this.mescroll.resetUpScroll()
  119. } else {
  120. uni.showToast({
  121. title: res.data.msg,
  122. icon: 'none'
  123. })
  124. }
  125. })
  126. },
  127. getStatus() {
  128. var that = this
  129. statusList().then(res => {
  130. this.status = res.data.data,
  131. this.nStatus = ''
  132. // that.$router.go(0)
  133. // this.mescroll.resetUpScroll();
  134. })
  135. },
  136. getInfo() {
  137. getInfo().then(res => {
  138. // this.setData({
  139. // money:res.data.data.dBalance
  140. // })
  141. })
  142. },
  143. refresh() {
  144. },
  145. getList(page) {
  146. console.log('++++++')
  147. var openid = {
  148. cOpenId: uni.getStorageSync('wx_copenid'),
  149. nStatus: this.nStatus,
  150. current: page.num,
  151. size: page.size,
  152. }
  153. orderDeatails(openid).then(res => {
  154. console.log(res)
  155. if (res.data.data.code == 401) {
  156. this.isLogin = false
  157. }
  158. var charToRemove = "T";
  159. res.data.data.records.forEach(element => {
  160. element.dtCreateTime = element.dtCreateTime.replace(charToRemove, ' ')
  161. });
  162. // this.list = res.data.data.records
  163. this.mescroll.endSuccess(res.data.data.records.length);
  164. this.list = this.list.concat(res.data.data.records)
  165. })
  166. },
  167. // 删除订单
  168. deleteOrder(e) {
  169. var that = this
  170. var id = {
  171. cId: e
  172. }
  173. uni.showModal({
  174. title: '提示',
  175. content: '确定删除订单吗?',
  176. showCancel: true, // 是否显示取消按钮
  177. success(res) {
  178. if (res.confirm) {
  179. delOrder(id).then(res => {
  180. if (res.data.code == 200) {
  181. // that.mescroll.resetUpScroll();
  182. that.$router.go(0)
  183. that.getList()
  184. uni.showToast({
  185. title: '删除订单成功!',
  186. icon: 'none'
  187. })
  188. // setTimeout(() => {
  189. // }, 100)
  190. } else {
  191. uni.showToast({
  192. title: res.data.msg,
  193. icon: 'none'
  194. })
  195. }
  196. })
  197. }
  198. }
  199. })
  200. },
  201. //订单详情
  202. goDetails(cid) {
  203. uni.navigateTo({
  204. url: '../../pages/order/order_detail?cid=' + cid
  205. })
  206. },
  207. //切换订单
  208. statusTap(code, index) {
  209. this.checkedIndex = index
  210. this.list = []
  211. this.nStatus = code
  212. this.mescroll.resetUpScroll();
  213. },
  214. },
  215. mounted() {
  216. this.mescroll.optDown.use = false
  217. },
  218. onLoad() {
  219. const value = uni.getStorageSync('wx_copenid');
  220. if (value == '') {
  221. this.isLogin = false
  222. } else {
  223. this.isLogin = true
  224. }
  225. },
  226. onShow() {
  227. this.getStatus()
  228. this.mescroll.resetUpScroll()
  229. // this.checkedIndex = 0,
  230. // this.nStatus = 100
  231. // this.getInfo()
  232. },
  233. onHide() {
  234. this.checkedIndex = 0
  235. this.nStatus = 100
  236. this.list = []
  237. }
  238. }
  239. </script>
  240. <style scoped lang="scss">
  241. // ::v-deep.mescroll-uni-fixed {
  242. // position: static;
  243. // overflow-y: auto;
  244. // }
  245. .order {
  246. width: 100vw;
  247. height: 100%;
  248. // background: radial-gradient(circle, #b1fffc, #fcfdff);
  249. background: linear-gradient(180deg, #C1FFF8 0%, #B8FFF3 34%, #F5FFFF 100%);
  250. // display: flex;
  251. // flex-direction: column;
  252. position: fixed;
  253. box-sizing: border-box;
  254. .top {
  255. width: 100%;
  256. height: 90rpx;
  257. display: flex;
  258. justify-content: space-around;
  259. align-items: center;
  260. font-size: 30rpx;
  261. // padding: 20rpx 0;
  262. box-sizing: border-box;
  263. z-index: 999;
  264. background: radial-gradient(circle, #fcfdff, #fcfdff);
  265. view {
  266. height: 100%;
  267. display: flex;
  268. align-items: center;
  269. padding: 0px 10rpx;
  270. background-color: #fff;
  271. box-sizing: border-box;
  272. // padding-bottom: 12rpx;
  273. // border-radius: 8rpx;
  274. }
  275. .active {
  276. font-size: 30rpx;
  277. color: #03C8BE;
  278. font-weight: 400;
  279. position: relative;
  280. }
  281. .active::after{
  282. content: '';
  283. position: absolute;
  284. bottom: 0;
  285. left: 50%;
  286. transform: translateX(-50%);
  287. width: 36rpx;
  288. height: 4rpx; /* 设置你需要的高度 */
  289. background-color: #03C8BE;
  290. }
  291. }
  292. .list {
  293. padding: 32rpx;
  294. flex: 1;
  295. // overflow-y: auto;
  296. // padding-top: 20rpx;
  297. // .list_box{
  298. // height: 100%;
  299. .item {
  300. // margin: 0 20rpx;
  301. width: 100%;
  302. // height: 292rpx;
  303. padding: 24rpx 32rpx;
  304. margin-bottom: 10rpx;
  305. font-size: 28rpx;
  306. margin-bottom: 28rpx;
  307. box-sizing: border-box;
  308. background: #FFFFFF;
  309. box-shadow: 0px 4px 12px 0px rgba(88, 209, 187, 0.1);
  310. border-radius: 24px 24px 24px 24px;
  311. .lTitle {
  312. display: flex;
  313. justify-content: space-between;
  314. border-bottom: 1px solid #eeeeee;
  315. margin-bottom: 10rpx;
  316. padding-bottom: 20rpx;
  317. font-size: 28rpx;
  318. .status {
  319. color: #03C8BE;
  320. }
  321. }
  322. .cont {
  323. color: rgb(162, 162, 162);
  324. font-size: 26rpx;
  325. // display: flex;
  326. // justify-content: space-between;
  327. line-height: 45rpx;
  328. }
  329. .btn {
  330. height: 48rpx;
  331. // text-align: right;
  332. // padding-top: 20rpx;
  333. margin-top: 20rpx;
  334. // margin-bottom: 24rpx;
  335. display: flex;
  336. align-items: center;
  337. justify-content: space-between;
  338. .count_down {
  339. // width: 41%;
  340. // text-align: left;
  341. font-size: 26rpx;
  342. color: #F53E54;
  343. span {
  344. font-size: 20rpx;
  345. }
  346. }
  347. .button {
  348. .pay {
  349. display: inline-block;
  350. background-color: rgb(46, 188, 215);
  351. color: #fff;
  352. margin-left: 20rpx;
  353. padding: 5rpx 30rpx;
  354. height: 48rpx;
  355. line-height: 48rpx;
  356. background: linear-gradient(135deg, #1AD8CF 0%, #21C8C0 100%);
  357. border-radius: 98rpx 98rpx 98rpx 98rpx;
  358. }
  359. .cancel {
  360. width: 152rpx;
  361. height: 48rpx;
  362. border-radius: 98rpx;
  363. border: 2rpx solid #BBBBBB;
  364. padding: 5rpx 30rpx;
  365. }
  366. }
  367. }
  368. }
  369. // }
  370. }
  371. }
  372. .login {
  373. margin-top: 300px;
  374. display: flex;
  375. flex-direction: column;
  376. align-items: center;
  377. text {
  378. margin-bottom: 50px;
  379. color: gray;
  380. }
  381. .login_btn {
  382. width: 100px;
  383. height: 30px;
  384. border-radius: 30px;
  385. text-align: center;
  386. color: #FFF;
  387. line-height: 30px;
  388. background: linear-gradient(to right, #35c99d, #27aea7);
  389. }
  390. }
  391. .nodate {
  392. display: flex;
  393. align-items: center;
  394. justify-content: center;
  395. padding: 200rpx 0;
  396. text-align: center;
  397. image {
  398. width: 300rpx;
  399. margin-bottom: 30rpx;
  400. }
  401. }
  402. ::-webkit-scrollbar {
  403. display: none;
  404. }
  405. </style>