integralOrderList.vue 9.2 KB

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