storeOrderList.vue 11 KB

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