storeOrderList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <view>
  3. <view class="top-fixed">
  4. <u-tabs
  5. :scrollable="false"
  6. :list="tabs"
  7. lineColor="#FF5C03"
  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==''?'/static/images/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" style="width: 90rpx;" @click.stop="doShare(item)">分享</view>
  63. <view class="btn" @click="showDetail(item)">查看订单</view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </mescroll-body>
  70. <u-popup :show="showShare" @close="showShare = false" >
  71. <share-box :shareItem="shareItem" @closeShare='showShare = false' ></share-box>
  72. </u-popup>
  73. </view>
  74. </template>
  75. <script>
  76. import {getDictByKey} from '@/api/common.js'
  77. import {getCompanyUserStoreOrderList,cancelOrder,finishOrder} from '@/api/storeOrder'
  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:"4"}
  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://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  106. tip: '暂无数据'
  107. }
  108. },
  109. // 列表数据
  110. dataList: [],
  111. isH5:false,
  112. showShare:false,
  113. shareItem:{ imageUrl:"",title:"",path:"",isMini:true },
  114. };
  115. },
  116. onLoad(option) {
  117. var that=this;
  118. uni.$on('refreshStoreOrder', () => {
  119. that.mescroll.resetUpScroll()
  120. })
  121. this.getDictByKey("sys_order_status");
  122. //#ifdef H5
  123. this.isH5=true;
  124. //#endif
  125. },
  126. methods: {
  127. getDictByKey(key){
  128. var data={key:key}
  129. getDictByKey(data).then(
  130. res => {
  131. if(res.code==200){
  132. if(key=="sys_order_status"){
  133. this.orderStatusOptions=res.data;
  134. }
  135. }
  136. },
  137. err => {
  138. }
  139. );
  140. },
  141. goSearch(e) {
  142. this.searchKey=e.detail.value;
  143. this.mescroll.resetUpScroll()
  144. },
  145. refund(item) {
  146. uni.navigateTo({
  147. url: '/pages_order/storeOrderRefundApply?orderId='+item.orderId
  148. })
  149. },
  150. tabChange(item) {
  151. this.status = item.id
  152. this.mescroll.resetUpScroll()
  153. },
  154. mescrollInit(mescroll) {
  155. this.mescroll = mescroll;
  156. },
  157. /*下拉刷新的回调 */
  158. downCallback(mescroll) {
  159. mescroll.resetUpScroll()
  160. },
  161. upCallback(page) {
  162. //联网加载数据
  163. var that = this;
  164. var data = {
  165. keyword:this.searchKey,
  166. status:this.status,
  167. pageNum: page.num,
  168. pageSize: page.size
  169. };
  170. getCompanyUserStoreOrderList(data).then(res => {
  171. if(res.code==200){
  172. //设置列表数据
  173. res.data.list.forEach(function(value, index, array){
  174. value.items=JSON.parse(value.itemJson)
  175. })
  176. if (page.num == 1) {
  177. that.dataList = res.data.list;
  178. } else {
  179. that.dataList = that.dataList.concat(res.data.list);
  180. }
  181. that.mescroll.endBySize(res.data.list.length, res.data.total);
  182. }else{
  183. uni.showToast({
  184. icon:'none',
  185. title: "请求失败",
  186. });
  187. that.dataList = null;
  188. that.mescroll.endErr();
  189. }
  190. });
  191. },
  192. // 查看订单详情
  193. showDetail(item) {
  194. uni.navigateTo({
  195. url: './storeOrderDetail?orderId=' + item.orderId
  196. })
  197. },
  198. finish(item){
  199. var that=this;
  200. uni.showModal({
  201. title: '提示',
  202. content: '确定已收货吗',
  203. success: function (res) {
  204. if (res.confirm) {
  205. var data = {
  206. orderId:item.orderId
  207. };
  208. finishOrder(data).then(res => {
  209. if(res.code==200){
  210. uni.showToast({
  211. icon:'success',
  212. title: "操作成功",
  213. });
  214. that.mescroll.resetUpScroll()
  215. }else{
  216. uni.showToast({
  217. icon:'none',
  218. title: res.msg,
  219. });
  220. }
  221. });
  222. }
  223. else if (res.cancel) {
  224. }
  225. }
  226. });
  227. },
  228. cancel(item){
  229. var that=this;
  230. uni.showModal({
  231. title: '提示',
  232. content: '确定取消订单吗',
  233. success: function (res) {
  234. if (res.confirm) {
  235. var data = {
  236. orderId:item.orderId
  237. };
  238. cancelOrder(data).then(res => {
  239. if(res.code==200){
  240. uni.showToast({
  241. icon:'success',
  242. title: "操作成功",
  243. });
  244. that.mescroll.resetUpScroll()
  245. }else{
  246. uni.showToast({
  247. icon:'none',
  248. title: res.msg,
  249. });
  250. }
  251. });
  252. }
  253. else if (res.cancel) {
  254. }
  255. }
  256. });
  257. },
  258. pay(item) {
  259. uni.navigateTo({
  260. url: '/pages_order/storeOrderPay?orderId='+item.orderId
  261. })
  262. },
  263. // 查看物流
  264. showDelivery(item) {
  265. uni.navigateTo({
  266. url: '/pages/store/storeOrderDelivery?orderId='+item.orderId
  267. })
  268. },
  269. doShare(item){
  270. if(this.isH5){
  271. return;
  272. }
  273. for (var i = 0; i < item.items.length; i++) {
  274. let subItem=item.items[i];
  275. if(JSON.parse(subItem.jsonInfo).image==''){
  276. this.shareItem.imageUrl='/static/images/drug.svg';
  277. }else{
  278. this.shareItem.imageUrl=JSON.parse(subItem.jsonInfo).image;
  279. this.shareItem.compressImage = 1
  280. }
  281. this.shareItem.title=JSON.parse(subItem.jsonInfo).productName;
  282. if(i==0){
  283. break;
  284. }
  285. }
  286. this.shareItem.isMini=true;
  287. this.shareItem.path="/pages_order/storeOrderDetail?orderId="+item.orderId;
  288. let cdn=uni.getStorageSync('h5Path');
  289. this.shareItem.url=cdn+"/pages/store/storeOrderDetail?orderId="+item.orderId;
  290. this.showShare=true;
  291. }
  292. }
  293. }
  294. </script>
  295. <style lang="scss">
  296. .top-fixed{
  297. width: 100%;
  298. position: absolute;
  299. top: 0;
  300. left: 0;
  301. z-index: 10;
  302. height: 88upx;
  303. background-color: #fff;
  304. }
  305. .order-list{
  306. padding: 20upx;
  307. .item{
  308. background: #FFFFFF;
  309. border-radius: 16upx;
  310. padding: 0 30upx;
  311. margin-bottom: 20upx;
  312. .ordersn-box{
  313. display: flex;
  314. align-items: center;
  315. justify-content: space-between;
  316. padding: 34upx 0 20upx;
  317. .num{
  318. font-size: 26upx;
  319. font-family: PingFang SC;
  320. font-weight: 500;
  321. color: #999999;
  322. line-height: 1;
  323. }
  324. .status-box{
  325. display: flex;
  326. align-items: center;
  327. .text{
  328. font-size: 28upx;
  329. font-family: PingFang SC;
  330. font-weight: 500;
  331. line-height: 1;
  332. &.success{
  333. color: #FF5C03;
  334. }
  335. &.black{
  336. color: #111111;
  337. }
  338. &.info{
  339. color: #999999;
  340. }
  341. }
  342. }
  343. }
  344. .drug-list{
  345. .drug-item{
  346. padding: 30upx 0;
  347. border-bottom: 1px soli #F0F0F0;
  348. display: flex;
  349. align-items: center;
  350. .img-box{
  351. width: 160upx;
  352. height: 160upx;
  353. margin-right: 30upx;
  354. flex-shrink: 0;
  355. image{
  356. width: 100%;
  357. height: 100%;
  358. }
  359. }
  360. .drug-info{
  361. width: calc(100% - 190upx);
  362. height: 160upx;
  363. display: flex;
  364. flex-direction: column;
  365. justify-content: space-between;
  366. .name-box{
  367. font-size: 28upx;
  368. font-family: PingFang SC;
  369. font-weight: 500;
  370. color: #111111;
  371. line-height: 40upx;
  372. .tag{
  373. display: inline-block;
  374. padding: 0 6upx;
  375. height: 30upx;
  376. background: linear-gradient(90deg, #C39A58 0%, #E2C99E 100%);
  377. border-radius: 4upx;
  378. margin-right: 10upx;
  379. font-size: 22upx;
  380. font-family: PingFang SC;
  381. font-weight: bold;
  382. color: #FFFFFF;
  383. line-height: 30upx;
  384. float: left;
  385. margin-top: 7upx;
  386. }
  387. }
  388. .spec{
  389. font-size: 24upx;
  390. font-family: PingFang SC;
  391. font-weight: 500;
  392. color: #999999;
  393. line-height: 1;
  394. margin-top: 10upx;
  395. }
  396. .num-box{
  397. display: flex;
  398. align-items: center;
  399. justify-content: space-between;
  400. .price{
  401. display: flex;
  402. align-items: flex-end;
  403. .unit{
  404. font-size: 24upx;
  405. font-family: PingFang SC;
  406. font-weight: 500;
  407. color: #111111;
  408. line-height: 1.2;
  409. margin-right: 4upx;
  410. }
  411. .num{
  412. font-size: 32upx;
  413. font-family: PingFang SC;
  414. font-weight: 500;
  415. color: #111111;
  416. line-height: 1;
  417. }
  418. }
  419. .amount{
  420. font-size: 24upx;
  421. font-family: PingFang SC;
  422. font-weight: 500;
  423. color: #999999;
  424. line-height: 1;
  425. }
  426. }
  427. }
  428. }
  429. .bottom-box{
  430. height: 110upx;
  431. display: flex;
  432. align-items: center;
  433. justify-content: space-between;
  434. .amount-paid{
  435. display: flex;
  436. align-items: center;
  437. .label{
  438. font-size: 24upx;
  439. font-family: PingFang SC;
  440. font-weight: 500;
  441. color: #999999;
  442. line-height: 1;
  443. }
  444. .price-box{
  445. display: flex;
  446. align-items: flex-end;
  447. .unit{
  448. font-size: 24upx;
  449. font-family: PingFang SC;
  450. font-weight: 500;
  451. color: #FF6633;
  452. line-height: 1.2;
  453. margin-right: 4upx;
  454. }
  455. .num{
  456. font-size: 32upx;
  457. font-family: PingFang SC;
  458. font-weight: bold;
  459. color: #FF6633;
  460. line-height: 1;
  461. }
  462. }
  463. }
  464. .btn-box{
  465. box-sizing: border-box;
  466. display: flex;
  467. align-items: center;
  468. .btn{
  469. position: relative;
  470. width: 130upx;
  471. height: 64upx;
  472. line-height: 64upx;
  473. font-size: 26upx;
  474. font-family: PingFang SC;
  475. font-weight: 500;
  476. text-align: center;
  477. border-radius: 32upx;
  478. margin-left: 15upx;
  479. &:first-child{
  480. margin-left: 0;
  481. }
  482. &.cancel{
  483. border: 1px solid #DDDDDD;
  484. color: #666666;
  485. }
  486. &.pay{
  487. background: #FF5C03;
  488. color: #FFFFFF;
  489. }
  490. .contact-btn {
  491. top: 0;
  492. position: absolute;
  493. width:100%;
  494. height:100%;
  495. opacity: 0;
  496. }
  497. }
  498. }
  499. }
  500. }
  501. }
  502. }
  503. </style>