integralOrderList.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <view class="content">
  3. <view class="top-fixed">
  4. <u-tabs
  5. :scrollable="false"
  6. :list="tabs"
  7. lineColor="#2583EB"
  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==''?'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/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. downOption: {
  93. //下拉刷新
  94. use: true,
  95. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  96. },
  97. // 上拉加载的配置
  98. upOption: {
  99. onScroll:false,
  100. use: true, // 是否启用上拉加载; 默认true
  101. page: {
  102. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  103. size: 10 // 每页数据的数量,默认10
  104. },
  105. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  106. textNoMore:"已经到底了",
  107. empty: {
  108. icon:'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/empty_icon.png',
  109. tip: '暂无数据'
  110. }
  111. },
  112. // 列表数据
  113. dataList: []
  114. }
  115. },
  116. onLoad() {
  117. this.getDictByKey("sys_integral_order_status");
  118. },
  119. methods: {
  120. getDictByKey(key){
  121. var data={key:key}
  122. getDictByKey(data).then(
  123. res => {
  124. if(res.code==200){
  125. if(key=="sys_integral_order_status"){
  126. this.orderStatusOptions=res.data;
  127. }
  128. }
  129. },
  130. err => {
  131. }
  132. );
  133. },
  134. tabChange(item) {
  135. this.status = item.id
  136. this.mescroll.resetUpScroll()
  137. },
  138. mescrollInit(mescroll) {
  139. this.mescroll = mescroll;
  140. },
  141. /*下拉刷新的回调 */
  142. downCallback(mescroll) {
  143. mescroll.resetUpScroll()
  144. },
  145. upCallback(page) {
  146. //联网加载数据
  147. var that = this;
  148. var data = {
  149. keyword:this.searchKey,
  150. status:this.status,
  151. pageNum: page.num,
  152. pageSize: page.size
  153. };
  154. getIntegralOrderList(data).then(res => {
  155. if(res.code==200){
  156. res.data.list.forEach(function(value, index, array){
  157. value.items=[];
  158. value.items.push(JSON.parse(value.itemJson))
  159. })
  160. //设置列表数据
  161. if (page.num == 1) {
  162. that.dataList = res.data.list;
  163. } else {
  164. that.dataList = that.dataList.concat(res.data.list);
  165. }
  166. that.mescroll.endBySize(res.data.list.length, res.data.total);
  167. }else{
  168. uni.showToast({
  169. icon:'none',
  170. title: "请求失败",
  171. });
  172. that.dataList = null;
  173. that.mescroll.endErr();
  174. }
  175. });
  176. },
  177. // 查看订单详情
  178. showDetail(item) {
  179. uni.navigateTo({
  180. url: './integralOrderDetails?orderId=' + item.orderId
  181. })
  182. },
  183. }
  184. }
  185. </script>
  186. <style scoped lang="scss">
  187. .top-fixed{
  188. width: 100%;
  189. position: fixed;
  190. top: 0;
  191. left: 0;
  192. z-index: 10;
  193. height: 88upx;
  194. background-color: #fff;
  195. }
  196. .order-list{
  197. padding: 20upx;
  198. .item{
  199. background: #FFFFFF;
  200. border-radius: 16upx;
  201. padding: 0 30upx;
  202. margin-bottom: 20upx;
  203. .ordersn-box{
  204. display: flex;
  205. align-items: center;
  206. justify-content: space-between;
  207. padding: 34upx 0 20upx;
  208. .num{
  209. font-size: 26upx;
  210. font-family: PingFang SC;
  211. font-weight: 500;
  212. color: #999999;
  213. line-height: 1;
  214. }
  215. .status-box{
  216. display: flex;
  217. align-items: center;
  218. .text{
  219. font-size: 28upx;
  220. font-family: PingFang SC;
  221. font-weight: 500;
  222. line-height: 1;
  223. &.success{
  224. color: #2583EB;
  225. }
  226. &.black{
  227. color: #111111;
  228. }
  229. &.info{
  230. color: #999999;
  231. }
  232. }
  233. }
  234. }
  235. .drug-list{
  236. .drug-item{
  237. padding: 30upx 0;
  238. border-bottom: 1px soli #F0F0F0;
  239. display: flex;
  240. align-items: center;
  241. .img-box{
  242. width: 160upx;
  243. height: 160upx;
  244. margin-right: 30upx;
  245. flex-shrink: 0;
  246. image{
  247. width: 100%;
  248. height: 100%;
  249. }
  250. }
  251. .drug-info{
  252. width: calc(100% - 190upx);
  253. height: 160upx;
  254. display: flex;
  255. flex-direction: column;
  256. justify-content: space-between;
  257. .name-box{
  258. font-size: 28upx;
  259. font-family: PingFang SC;
  260. font-weight: 500;
  261. color: #111111;
  262. line-height: 40upx;
  263. .tag{
  264. display: inline-block;
  265. padding: 0 6upx;
  266. height: 30upx;
  267. background: linear-gradient(90deg, #2583EB 0%, #2EDAD4 100%);
  268. border-radius: 4upx;
  269. margin-right: 10upx;
  270. font-size: 22upx;
  271. font-family: PingFang SC;
  272. font-weight: bold;
  273. color: #FFFFFF;
  274. line-height: 30upx;
  275. float: left;
  276. margin-top: 7upx;
  277. }
  278. }
  279. .spec{
  280. font-size: 24upx;
  281. font-family: PingFang SC;
  282. font-weight: 500;
  283. color: #999999;
  284. line-height: 1;
  285. margin-top: 10upx;
  286. }
  287. .num-box{
  288. display: flex;
  289. align-items: center;
  290. justify-content: space-between;
  291. .price{
  292. display: flex;
  293. align-items: flex-end;
  294. .unit{
  295. font-size: 24upx;
  296. font-family: PingFang SC;
  297. font-weight: 500;
  298. color: #111111;
  299. line-height: 1.2;
  300. margin-right: 4upx;
  301. }
  302. .num{
  303. font-size: 32upx;
  304. font-family: PingFang SC;
  305. font-weight: 500;
  306. color: #111111;
  307. line-height: 1;
  308. }
  309. }
  310. .amount{
  311. font-size: 24upx;
  312. font-family: PingFang SC;
  313. font-weight: 500;
  314. color: #999999;
  315. line-height: 1;
  316. }
  317. }
  318. }
  319. }
  320. .bottom-box{
  321. height: 110upx;
  322. display: flex;
  323. align-items: center;
  324. justify-content: space-between;
  325. .amount-paid{
  326. display: flex;
  327. align-items: center;
  328. .label{
  329. font-size: 24upx;
  330. font-family: PingFang SC;
  331. font-weight: 500;
  332. color: #999999;
  333. line-height: 1;
  334. }
  335. .price-box{
  336. display: flex;
  337. align-items: flex-end;
  338. .unit{
  339. font-size: 24upx;
  340. font-family: PingFang SC;
  341. font-weight: 500;
  342. color: #FF6633;
  343. line-height: 1.2;
  344. margin-right: 4upx;
  345. }
  346. .num{
  347. font-size: 32upx;
  348. font-family: PingFang SC;
  349. font-weight: bold;
  350. color: #FF6633;
  351. line-height: 1;
  352. }
  353. }
  354. }
  355. .btn-box{
  356. box-sizing: border-box;
  357. display: flex;
  358. align-items: center;
  359. .btn{
  360. position: relative;
  361. width: 155upx;
  362. height: 64upx;
  363. line-height: 64upx;
  364. font-size: 26upx;
  365. font-family: PingFang SC;
  366. font-weight: 500;
  367. text-align: center;
  368. border-radius: 32upx;
  369. margin-left: 15upx;
  370. &:first-child{
  371. margin-left: 0;
  372. }
  373. &.cancel{
  374. border: 1px solid #DDDDDD;
  375. color: #666666;
  376. }
  377. &.pay{
  378. background: #2583EB;
  379. color: #FFFFFF;
  380. }
  381. .contact-btn {
  382. top: 0;
  383. position: absolute;
  384. width:100%;
  385. height:100%;
  386. opacity: 0;
  387. }
  388. }
  389. }
  390. }
  391. }
  392. }
  393. }
  394. </style>