integralOrderList.vue 9.3 KB

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