storeOrderList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <template>
  2. <view>
  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 @click="showDetail(item)" v-for="(item,index) in dataList" :key="index" class="item" >
  15. <!-- 订单号,状态 -->
  16. <view class="ordersn-box" >
  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. <!-- 药品列表 -->
  31. <view class="drug-list" >
  32. <view v-if="item.isPackage!=1" v-for="(subItem,subIndex) in item.items" :key="subIndex" class="drug-item" >
  33. <view class="img-box">
  34. <image :src="JSON.parse(subItem.jsonInfo).image==''?'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/drug.svg':JSON.parse(subItem.jsonInfo).image" mode="aspectFill"></image>
  35. </view>
  36. <view class="drug-info" >
  37. <view>
  38. <view class="name-box ellipsis2">
  39. {{JSON.parse(subItem.jsonInfo).productName}}
  40. </view>
  41. <view class="spec ellipsis2">{{JSON.parse(subItem.jsonInfo).sku}}</view>
  42. </view>
  43. <view class="num-box">
  44. <view class="price">
  45. <!-- <text class="unit">¥</text> -->
  46. <!-- <text class="num" v-if="JSON.parse(subItem.jsonInfo).price!=null">{{JSON.parse(subItem.jsonInfo).price.toFixed(2)}}</text> -->
  47. </view>
  48. <view class="amount" v-if="item.ordetType==1">x{{JSON.parse(subItem.jsonInfo).num}}</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.payPrice.toFixed(2)}}</view>
  59. </view>
  60. </view>
  61. <view class="btn-box">
  62. <view class="btn" @click="showDetail(item)">查看订单</view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </mescroll-body>
  69. </view>
  70. </template>
  71. <script>
  72. import {getDictByKey} from '@/api/common.js'
  73. import {getCompanyUserStoreOrderList,cancelOrder,finishOrder} from '@/api/storeOrder'
  74. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  75. export default {
  76. mixins: [MescrollMixin],
  77. data() {
  78. return {
  79. orderStatusOptions:[],
  80. searchKey:"",
  81. status:"0",
  82. tabs: [
  83. {name:"全部",id:"0"},
  84. {name:"待付款",id:"1"},
  85. {name:"待发货",id:"2"},
  86. {name:"待收货",id:"3"},
  87. {name:"已完成",id:"4"}
  88. ],
  89. mescroll:null,
  90. downOption: {
  91. //下拉刷新
  92. use: true,
  93. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  94. },
  95. // 上拉加载的配置
  96. upOption: {
  97. onScroll:false,
  98. use: true, // 是否启用上拉加载; 默认true
  99. page: {
  100. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  101. size: 10 // 每页数据的数量,默认10
  102. },
  103. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  104. textNoMore:"已经到底了",
  105. empty: {
  106. icon:'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/empty_icon.png',
  107. tip: '暂无数据'
  108. }
  109. },
  110. // 列表数据
  111. dataList: []
  112. };
  113. },
  114. onLoad(option) {
  115. var that=this;
  116. uni.$on('refreshStoreOrder', () => {
  117. that.mescroll.resetUpScroll()
  118. })
  119. this.getDictByKey("sys_order_status");
  120. },
  121. methods: {
  122. getDictByKey(key){
  123. var data={key:key}
  124. getDictByKey(data).then(
  125. res => {
  126. if(res.code==200){
  127. if(key=="sys_order_status"){
  128. this.orderStatusOptions=res.data;
  129. }
  130. }
  131. },
  132. err => {
  133. }
  134. );
  135. },
  136. goSearch(e) {
  137. this.searchKey=e.detail.value;
  138. this.mescroll.resetUpScroll()
  139. },
  140. refund(item) {
  141. uni.navigateTo({
  142. url: '/pages_order/storeOrderRefundApply?orderId='+item.orderId
  143. })
  144. },
  145. tabChange(item) {
  146. this.status = item.id
  147. this.mescroll.resetUpScroll()
  148. },
  149. mescrollInit(mescroll) {
  150. this.mescroll = mescroll;
  151. },
  152. /*下拉刷新的回调 */
  153. downCallback(mescroll) {
  154. mescroll.resetUpScroll()
  155. },
  156. upCallback(page) {
  157. //联网加载数据
  158. var that = this;
  159. var data = {
  160. keyword:this.searchKey,
  161. status:this.status,
  162. pageNum: page.num,
  163. pageSize: page.size
  164. };
  165. getCompanyUserStoreOrderList(data).then(res => {
  166. if(res.code==200){
  167. //设置列表数据
  168. res.data.list.forEach(function(value, index, array){
  169. value.items=JSON.parse(value.itemJson)
  170. })
  171. if (page.num == 1) {
  172. that.dataList = res.data.list;
  173. } else {
  174. that.dataList = that.dataList.concat(res.data.list);
  175. }
  176. that.mescroll.endBySize(res.data.list.length, res.data.total);
  177. }else{
  178. uni.showToast({
  179. icon:'none',
  180. title: "请求失败",
  181. });
  182. that.dataList = null;
  183. that.mescroll.endErr();
  184. }
  185. });
  186. },
  187. // 查看订单详情
  188. showDetail(item) {
  189. uni.navigateTo({
  190. url: './storeOrderDetail?orderId=' + item.orderId
  191. })
  192. },
  193. finish(item){
  194. var that=this;
  195. uni.showModal({
  196. title: '提示',
  197. content: '确定已收货吗',
  198. success: function (res) {
  199. if (res.confirm) {
  200. var data = {
  201. orderId:item.orderId
  202. };
  203. finishOrder(data).then(res => {
  204. if(res.code==200){
  205. uni.showToast({
  206. icon:'success',
  207. title: "操作成功",
  208. });
  209. that.mescroll.resetUpScroll()
  210. }else{
  211. uni.showToast({
  212. icon:'none',
  213. title: res.msg,
  214. });
  215. }
  216. });
  217. }
  218. else if (res.cancel) {
  219. }
  220. }
  221. });
  222. },
  223. cancel(item){
  224. var that=this;
  225. uni.showModal({
  226. title: '提示',
  227. content: '确定取消订单吗',
  228. success: function (res) {
  229. if (res.confirm) {
  230. var data = {
  231. orderId:item.orderId
  232. };
  233. cancelOrder(data).then(res => {
  234. if(res.code==200){
  235. uni.showToast({
  236. icon:'success',
  237. title: "操作成功",
  238. });
  239. that.mescroll.resetUpScroll()
  240. }else{
  241. uni.showToast({
  242. icon:'none',
  243. title: res.msg,
  244. });
  245. }
  246. });
  247. }
  248. else if (res.cancel) {
  249. }
  250. }
  251. });
  252. },
  253. pay(item) {
  254. uni.navigateTo({
  255. url: '/pages_order/storeOrderPay?orderId='+item.orderId
  256. })
  257. },
  258. // 查看物流
  259. showDelivery(item) {
  260. uni.navigateTo({
  261. url: './storeOrderDelivery?orderId='+item.orderId
  262. })
  263. }
  264. }
  265. }
  266. </script>
  267. <style lang="scss">
  268. .top-fixed{
  269. width: 100%;
  270. position: fixed;
  271. top: 0;
  272. left: 0;
  273. z-index: 10;
  274. height: 88upx;
  275. background-color: #fff;
  276. }
  277. .order-list{
  278. padding: 20upx;
  279. .item{
  280. background: #FFFFFF;
  281. border-radius: 16upx;
  282. padding: 0 30upx;
  283. margin-bottom: 20upx;
  284. .ordersn-box{
  285. display: flex;
  286. align-items: center;
  287. justify-content: space-between;
  288. padding: 34upx 0 20upx;
  289. .num{
  290. font-size: 26upx;
  291. font-family: PingFang SC;
  292. font-weight: 500;
  293. color: #999999;
  294. line-height: 1;
  295. }
  296. .status-box{
  297. display: flex;
  298. align-items: center;
  299. .text{
  300. font-size: 28upx;
  301. font-family: PingFang SC;
  302. font-weight: 500;
  303. line-height: 1;
  304. &.success{
  305. color: #2583EB;
  306. }
  307. &.black{
  308. color: #111111;
  309. }
  310. &.info{
  311. color: #999999;
  312. }
  313. }
  314. }
  315. }
  316. .drug-list{
  317. .drug-item{
  318. padding: 30upx 0;
  319. border-bottom: 1px soli #F0F0F0;
  320. display: flex;
  321. align-items: center;
  322. .img-box{
  323. width: 160upx;
  324. height: 160upx;
  325. margin-right: 30upx;
  326. flex-shrink: 0;
  327. image{
  328. width: 100%;
  329. height: 100%;
  330. }
  331. }
  332. .drug-info{
  333. width: calc(100% - 190upx);
  334. height: 160upx;
  335. display: flex;
  336. flex-direction: column;
  337. justify-content: space-between;
  338. .name-box{
  339. font-size: 28upx;
  340. font-family: PingFang SC;
  341. font-weight: 500;
  342. color: #111111;
  343. line-height: 40upx;
  344. .tag{
  345. display: inline-block;
  346. padding: 0 6upx;
  347. height: 30upx;
  348. background: linear-gradient(90deg, #2583EB 0%, #2EDAD4 100%);
  349. border-radius: 4upx;
  350. margin-right: 10upx;
  351. font-size: 22upx;
  352. font-family: PingFang SC;
  353. font-weight: bold;
  354. color: #FFFFFF;
  355. line-height: 30upx;
  356. float: left;
  357. margin-top: 7upx;
  358. }
  359. }
  360. .spec{
  361. font-size: 24upx;
  362. font-family: PingFang SC;
  363. font-weight: 500;
  364. color: #999999;
  365. line-height: 1;
  366. margin-top: 10upx;
  367. }
  368. .num-box{
  369. display: flex;
  370. align-items: center;
  371. justify-content: space-between;
  372. .price{
  373. display: flex;
  374. align-items: flex-end;
  375. .unit{
  376. font-size: 24upx;
  377. font-family: PingFang SC;
  378. font-weight: 500;
  379. color: #111111;
  380. line-height: 1.2;
  381. margin-right: 4upx;
  382. }
  383. .num{
  384. font-size: 32upx;
  385. font-family: PingFang SC;
  386. font-weight: 500;
  387. color: #111111;
  388. line-height: 1;
  389. }
  390. }
  391. .amount{
  392. font-size: 24upx;
  393. font-family: PingFang SC;
  394. font-weight: 500;
  395. color: #999999;
  396. line-height: 1;
  397. }
  398. }
  399. }
  400. }
  401. .bottom-box{
  402. height: 110upx;
  403. display: flex;
  404. align-items: center;
  405. justify-content: space-between;
  406. .amount-paid{
  407. display: flex;
  408. align-items: center;
  409. .label{
  410. font-size: 24upx;
  411. font-family: PingFang SC;
  412. font-weight: 500;
  413. color: #999999;
  414. line-height: 1;
  415. }
  416. .price-box{
  417. display: flex;
  418. align-items: flex-end;
  419. .unit{
  420. font-size: 24upx;
  421. font-family: PingFang SC;
  422. font-weight: 500;
  423. color: #FF6633;
  424. line-height: 1.2;
  425. margin-right: 4upx;
  426. }
  427. .num{
  428. font-size: 32upx;
  429. font-family: PingFang SC;
  430. font-weight: bold;
  431. color: #FF6633;
  432. line-height: 1;
  433. }
  434. }
  435. }
  436. .btn-box{
  437. box-sizing: border-box;
  438. display: flex;
  439. align-items: center;
  440. .btn{
  441. position: relative;
  442. width: 155upx;
  443. height: 64upx;
  444. line-height: 64upx;
  445. font-size: 26upx;
  446. font-family: PingFang SC;
  447. font-weight: 500;
  448. text-align: center;
  449. border-radius: 32upx;
  450. margin-left: 15upx;
  451. &:first-child{
  452. margin-left: 0;
  453. }
  454. &.cancel{
  455. border: 1px solid #DDDDDD;
  456. color: #666666;
  457. }
  458. &.pay{
  459. background: #2583EB;
  460. color: #FFFFFF;
  461. }
  462. .contact-btn {
  463. top: 0;
  464. position: absolute;
  465. width:100%;
  466. height:100%;
  467. opacity: 0;
  468. }
  469. }
  470. }
  471. }
  472. }
  473. }
  474. }
  475. </style>