packageOrderList.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <view class="content">
  3. <u-sticky>
  4. <view class="top-fixed">
  5. <u-tabs
  6. :scrollable="true"
  7. :list="tabs"
  8. lineColor="#2583EB"
  9. @change="tabChange">
  10. </u-tabs>
  11. </view>
  12. </u-sticky>
  13. <mescroll-body top="88rpx" bottom="0" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  14. <view class="order-box">
  15. <view class="order-item" @click.stop="showDetails(item)" v-for="(item) in dataList">
  16. <view class="top-box" >
  17. <view class="num">订单号:{{item.orderSn}}</view>
  18. <view class="status-box">
  19. <text class="text info" v-if="item.status==1">
  20. {{$getDictLabelName(orderStatusOptions,item.status)}}
  21. </text>
  22. <text class="text success" v-if="item.status>1">
  23. {{$getDictLabelName(orderStatusOptions,item.status)}}
  24. </text>
  25. <text class="text info" v-if="item.status<0">
  26. {{$getDictLabelName(orderStatusOptions,item.status)}}
  27. </text>
  28. </view>
  29. </view>
  30. <view class="package-box">
  31. <view class="left">
  32. <image :src="item.imgUrl"></image>
  33. </view>
  34. <view class="right">
  35. <view class="title">{{item.packageName}}</view>
  36. <view class="desc">
  37. <view class="cycle">服务周期{{item.cycle}}天</view>
  38. <view class="duration">签约时长{{item.duration}}天</view>
  39. </view>
  40. <!-- <view class="price-box">
  41. <view class="price">¥30元/日</view>
  42. <view class="count">6.2w人已购</view>
  43. </view> -->
  44. </view>
  45. </view>
  46. <view class="bottom-box">
  47. <view class="amount-paid">
  48. <text class="label">订单金额:</text>
  49. <view class="price-box">
  50. <view class="unit">¥</view>
  51. <view class="num" >{{item.payPrice.toFixed(2)}}</view>
  52. </view>
  53. </view>
  54. <view class="btn-box">
  55. <!-- <view v-if="item.status == 1" class="btn cancel" @click="cancel(item)">取消订单</view> -->
  56. <view v-if="item.status == 1" class="btn pay" >查看订单</view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </mescroll-body>
  62. </view>
  63. </template>
  64. <script>
  65. import {getCompanyUserPackageOrderList} from '@/api/packageOrder'
  66. import {getDictByKey} from '@/api/common.js'
  67. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  68. export default {
  69. mixins: [MescrollMixin],
  70. data() {
  71. return {
  72. orderStatusOptions:[],
  73. searchKey:"",
  74. status:"0",
  75. tabs: [
  76. {name:"全部",id:"0"},
  77. {name:"待支付",id:"1"},
  78. {name:"服务中",id:"2"},
  79. {name:"已完成",id:"3"},
  80. {name:"已取消",id:"-1"},
  81. {name:"已退款",id:"-2"}
  82. ],
  83. mescroll:null,
  84. downOption: { //下拉刷新
  85. use:true,
  86. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  87. },
  88. upOption: {
  89. onScroll:false,
  90. use: true, // 是否启用上拉加载; 默认true
  91. page: {
  92. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  93. size: 10 // 每页数据的数量,默认10
  94. },
  95. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  96. textNoMore:"已经到底了",
  97. empty: {
  98. icon:'https://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/cf4a86b913a04341bb44e34bb4d37aa2.png',
  99. tip: '暂无数据'
  100. }
  101. },
  102. dataList: []
  103. }
  104. },
  105. onLoad(options) {
  106. var that=this;
  107. uni.$on('refreshPackageOrder', () => {
  108. that.mescroll.resetUpScroll()
  109. })
  110. this.getDictByKey("sys_package_order_status");
  111. },
  112. onShow() {
  113. },
  114. methods: {
  115. getDictByKey(key){
  116. var data={key:key}
  117. getDictByKey(data).then(
  118. res => {
  119. if(res.code==200){
  120. if(key=="sys_package_order_status"){
  121. this.orderStatusOptions=res.data;
  122. }
  123. }
  124. },
  125. err => {
  126. }
  127. );
  128. },
  129. showDetails(item){
  130. uni.navigateTo({
  131. url:"/pages/company/packageOrderDetails?orderId="+item.orderId
  132. })
  133. },
  134. tabChange(item){
  135. this.status=item.id
  136. console.log(item)
  137. this.mescroll.resetUpScroll()
  138. },
  139. mescrollInit(mescroll) {
  140. this.mescroll = mescroll;
  141. },
  142. /*下拉刷新的回调 */
  143. downCallback(mescroll) {
  144. mescroll.resetUpScroll()
  145. },
  146. upCallback(page) {
  147. //联网加载数据
  148. var that = this;
  149. var data = {
  150. status:this.status,
  151. pageNum: page.num,
  152. pageSize: page.size
  153. };
  154. getCompanyUserPackageOrderList(data).then(res => {
  155. if(res.code==200){
  156. //设置列表数据
  157. if (page.num == 1) {
  158. that.dataList = res.data.list;
  159. } else {
  160. that.dataList = that.dataList.concat(res.data.list);
  161. }
  162. that.mescroll.endBySize(res.data.list.length, res.data.total);
  163. }else{
  164. uni.showToast({
  165. icon:'none',
  166. title: "请求失败",
  167. });
  168. that.dataList = null;
  169. that.mescroll.endErr();
  170. }
  171. });
  172. }
  173. }
  174. }
  175. </script>
  176. <style lang="scss">
  177. page{
  178. background: #f6f6f6;
  179. }
  180. </style>
  181. <style scoped lang="scss">
  182. .content{
  183. .top-fixed{
  184. width: 100%;
  185. position: absolute;
  186. top: 0;
  187. left: 0;
  188. z-index: 10;
  189. height: 88upx;
  190. background-color: #fff;
  191. }
  192. .order-box{
  193. padding: 20rpx;
  194. width: 100%;
  195. display: flex;
  196. flex-direction: column;
  197. align-items: center;
  198. justify-content: center;
  199. .order-item{
  200. width: 100%;
  201. border-radius: 10rpx;
  202. background-color: #fff;
  203. padding: 30rpx;
  204. margin-bottom: 20rpx;
  205. display: flex;
  206. flex-direction: column;
  207. align-items: flex-start;
  208. justify-content: flex-start;
  209. .top-box{
  210. width: 100%;
  211. display: flex;
  212. align-items: center;
  213. justify-content: space-between;
  214. .num{
  215. font-size: 26upx;
  216. font-family: PingFang SC;
  217. font-weight: 500;
  218. color: #999999;
  219. line-height: 1;
  220. }
  221. .status-box{
  222. display: flex;
  223. align-items: center;
  224. .text{
  225. font-size: 28upx;
  226. font-family: PingFang SC;
  227. font-weight: 500;
  228. line-height: 1;
  229. &.success{
  230. color: #2583EB;
  231. }
  232. &.black{
  233. color: #111111;
  234. }
  235. &.info{
  236. color: #999999;
  237. }
  238. }
  239. }
  240. }
  241. .package-box{
  242. margin-top: 20rpx;
  243. width: 100%;
  244. display: flex;
  245. align-items: flex-start;
  246. justify-content: flex-start;
  247. .left{
  248. width:200rpx;
  249. height:200rpx;
  250. image{
  251. border-radius: 15rpx;
  252. width:100%;
  253. height:100%;
  254. }
  255. }
  256. .right{
  257. height: 200rpx;
  258. display: flex;
  259. flex-direction: column;
  260. align-items: flex-start;
  261. justify-content: flex-start;
  262. padding-left: 15rpx;
  263. width:calc(100% - 200rpx);
  264. .title{
  265. font-weight: bold;
  266. font-size: 34upx;
  267. font-family: PingFang SC;
  268. color: #111;
  269. }
  270. .desc{
  271. margin-top: 15rpx;
  272. display: flex;
  273. align-items: flex-start;
  274. justify-content: flex-start;
  275. .cycle{
  276. background-color: #eee;
  277. border-radius: 30rpx;
  278. padding: 5rpx 15rpx;
  279. font-size: 26upx;
  280. font-family: PingFang SC;
  281. color: #2583EB;
  282. }
  283. .duration{
  284. margin-left: 10rpx;
  285. background-color: #eee;
  286. border-radius: 30rpx;
  287. padding: 5rpx 15rpx;
  288. font-size: 26upx;
  289. font-family: PingFang SC;
  290. color: #2583EB;
  291. }
  292. }
  293. .price-box{
  294. flex: 1;
  295. display: flex;
  296. align-items: flex-end;
  297. justify-content: space-between;
  298. width: 100%;
  299. .price{
  300. padding: 5rpx 10rpx;
  301. background-color: #2583EB;
  302. border-radius: 30rpx;
  303. font-size: 20upx;
  304. font-family: PingFang SC;
  305. color: #ffffff;
  306. }
  307. .count{
  308. font-size: 24upx;
  309. font-family: PingFang SC;
  310. color: #333333;
  311. }
  312. }
  313. }
  314. }
  315. .bottom-box{
  316. margin-top: 20rpx;
  317. width: 100%;
  318. display: flex;
  319. align-items: center;
  320. justify-content: space-between;
  321. .amount-paid{
  322. display: flex;
  323. align-items: center;
  324. .label{
  325. font-size: 24upx;
  326. font-family: PingFang SC;
  327. font-weight: 500;
  328. color: #999999;
  329. line-height: 1;
  330. }
  331. .price-box{
  332. display: flex;
  333. align-items: flex-end;
  334. .unit{
  335. font-size: 24upx;
  336. font-family: PingFang SC;
  337. font-weight: 500;
  338. color: #FF6633;
  339. line-height: 1.2;
  340. margin-right: 4upx;
  341. }
  342. .num{
  343. font-size: 32upx;
  344. font-family: PingFang SC;
  345. font-weight: bold;
  346. color: #FF6633;
  347. line-height: 1;
  348. }
  349. }
  350. }
  351. .btn-box{
  352. box-sizing: border-box;
  353. display: flex;
  354. align-items: center;
  355. .btn{
  356. width: 155upx;
  357. height: 64upx;
  358. line-height: 64upx;
  359. font-size: 26upx;
  360. font-family: PingFang SC;
  361. font-weight: 500;
  362. text-align: center;
  363. border-radius: 32upx;
  364. margin-left: 15upx;
  365. &:first-child{
  366. margin-left: 0;
  367. }
  368. &.cancel{
  369. border: 1px solid #DDDDDD;
  370. color: #666666;
  371. }
  372. &.pay{
  373. background: #2583EB;
  374. color: #FFFFFF;
  375. }
  376. }
  377. }
  378. }
  379. }
  380. }
  381. }
  382. </style>