packageOrderList.vue 9.1 KB

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