storeOrder.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <template>
  2. <view>
  3. <view class="top-fixed">
  4. <!-- tab切换 -->
  5. <view class="pub-tab-box">
  6. <view class="tab-inner">
  7. <view
  8. v-for="(item,index) in orderStatus"
  9. :key="index"
  10. :class="status ==item.value?'item active':'item'"
  11. @click="orderStatusChange(item)">
  12. <view class="text">
  13. {{ item.name }}
  14. <image v-show="status ==item.value" class="tab-bg" src="/static/image/mall/tab_bg.png" mode=""></image>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="search-cont">
  20. <view class="inner">
  21. <image class="icon-search" src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/search.png" mode=""></image>
  22. <input type="text" value="" placeholder="输入订单号" confirm-type="搜索" @confirm="goSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
  23. </view>
  24. </view>
  25. </view>
  26. <view class="top-seat"></view>
  27. <!-- 订单列表 -->
  28. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  29. <view class="order-list">
  30. <view v-for="(item,index) in dataList" :key="index" class="item" >
  31. <!-- 订单号,状态 -->
  32. <view class="ordersn-box" @click="showDetail(item)">
  33. <view class="num">订单号:{{item.orderCode}}</view>
  34. <view class="status-box">
  35. <!-- <view class="recom-box">推荐订单</view> -->
  36. <text class="text success">
  37. {{$getDictLabelName("storeOrderStatus",item.status)}}
  38. </text>
  39. </view>
  40. </view>
  41. <!-- 药品列表 -->
  42. <view class="drug-list" >
  43. <view @click="showDetail(item)" v-if="item.isPackage!=1" v-for="(subItem,subIndex) in item.items" :key="subIndex" class="drug-item" >
  44. <view class="img-box">
  45. <image :src="JSON.parse(subItem.jsonInfo).image" mode="aspectFill"></image>
  46. </view>
  47. <view class="drug-info" >
  48. <view>
  49. <view class="name-box ellipsis2">
  50. <view v-if="subItem.isPrescribe==1" class="tag">处方药</view>{{JSON.parse(subItem.jsonInfo).productName}}
  51. </view>
  52. <view class="spec ellipsis2">{{JSON.parse(subItem.jsonInfo).sku}}</view>
  53. </view>
  54. <view class="num-box">
  55. <view class="price">
  56. <text class="unit">¥</text>
  57. <text class="num">{{JSON.parse(subItem.jsonInfo).price.toFixed(2)}}</text>
  58. </view>
  59. <view class="amount">x{{JSON.parse(subItem.jsonInfo).num}}</view>
  60. </view>
  61. </view>
  62. </view>
  63. <view v-if="item.isPackage==1&&item.packageJson!=null" class="drug-item" @click="showDetail(item)">
  64. <view class="img-box">
  65. <image :src="JSON.parse(item.packageJson).imgUrl" mode="aspectFill"></image>
  66. </view>
  67. <view class="drug-info" >
  68. <view>
  69. <view class="name-box ellipsis2">
  70. <view class="tag">套餐</view>{{JSON.parse(item.packageJson).title}}
  71. </view>
  72. <view class="spec ellipsis2">{{JSON.parse(item.packageJson).descs}}</view>
  73. </view>
  74. <!-- <view class="num-box">
  75. <view class="price">
  76. <text class="unit">¥</text>
  77. <text class="num">{{JSON.parse(item.packageJson).payMoney.toFixed(2)}}</text>
  78. </view>
  79. <view class="amount"></view>
  80. </view> -->
  81. </view>
  82. </view>
  83. <!-- 实付金额、按钮 -->
  84. <view class="bottom-box">
  85. <view class="amount-paid">
  86. <text class="label">订单金额:</text>
  87. <view class="price-box">
  88. <view class="unit">¥</view>
  89. <view class="num" >{{item.payPrice.toFixed(2)}}</view>
  90. </view>
  91. </view>
  92. <view class="btn-box">
  93. <view v-if="item.status == 0" class="btn cancel" @click="cancel(item)">取消订单</view>
  94. <view v-if="item.status == 0" class="btn pay" @click="pay(item)">支付</view>
  95. <view v-if="item.isAfterSales==1" class="btn cancel" @click="refund(item)">申请售后</view>
  96. <view v-if="item.status >=2 &&item.deliveryId!=null" class="btn pay" @click.stop="showDelivery(item)">查看物流</view>
  97. <!-- <view v-if="item.status==4" class="btn pay">再次购买</view> -->
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </mescroll-body>
  104. <ykscreenRecord></ykscreenRecord>
  105. </view>
  106. </template>
  107. <script>
  108. import {getMyStoreOrderList,cancelOrder} from '@/api/storeOrder'
  109. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  110. import ykscreenRecord from "@/components/yk-screenRecord/yk-screenRecord.vue"
  111. export default {
  112. components: {
  113. ykscreenRecord
  114. },
  115. mixins: [MescrollMixin],
  116. data() {
  117. return {
  118. searchKey:"",
  119. status:0,
  120. orderStatus: [
  121. {name:"全部",value:""},
  122. {name:"待付款",value:"0"},
  123. {name:"待发货",value:"1"},
  124. {name:"待收货",value:"2"},
  125. {name:"已完成",value:"3"}
  126. ],
  127. mescroll:null,
  128. downOption: { //下拉刷新
  129. auto: true // 不自动加载 (mixin已处理第一个tab触发downCallback)
  130. },
  131. // 上拉加载的配置
  132. upOption: {
  133. onScroll:true,
  134. use: true, // 是否启用上拉加载; 默认true
  135. page: {
  136. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  137. size: 10 // 每页数据的数量,默认10
  138. },
  139. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  140. empty: {
  141. icon:'/static/images/empty.png',
  142. tip: '暂无数据'
  143. }
  144. },
  145. // 列表数据
  146. dataList: [],
  147. };
  148. },
  149. onLoad(option) {
  150. this.status = option.status
  151. var that=this;
  152. uni.$on('refreshOrder', () => {
  153. that.mescroll.resetUpScroll()
  154. });
  155. },
  156. methods: {
  157. goSearch(e) {
  158. this.searchKey=e.detail.value;
  159. this.mescroll.resetUpScroll()
  160. },
  161. refund(item) {
  162. uni.navigateTo({
  163. url: './refundOrderProduct?orderId='+item.id
  164. })
  165. },
  166. // tab切换
  167. orderStatusChange(item) {
  168. this.status = item.value
  169. this.mescroll.resetUpScroll()
  170. },
  171. mescrollInit(mescroll) {
  172. this.mescroll = mescroll;
  173. },
  174. /*下拉刷新的回调 */
  175. downCallback(mescroll) {
  176. mescroll.resetUpScroll()
  177. },
  178. upCallback(page) {
  179. //联网加载数据
  180. var that = this;
  181. var data = {
  182. keyword:this.searchKey,
  183. status:this.status,
  184. page: page.num,
  185. pageSize: page.size
  186. };
  187. getMyStoreOrderList(data).then(res => {
  188. if(res.code==200){
  189. //设置列表数据
  190. if (page.num == 1) {
  191. that.dataList = res.data.list;
  192. } else {
  193. that.dataList = that.dataList.concat(res.data.list);
  194. }
  195. that.mescroll.endBySize(res.data.list.length, res.data.total);
  196. }else{
  197. uni.showToast({
  198. icon:'none',
  199. title: "请求失败",
  200. });
  201. that.dataList = null;
  202. that.mescroll.endErr();
  203. }
  204. });
  205. },
  206. // 查看订单详情
  207. showDetail(item) {
  208. console.log(item)
  209. uni.navigateTo({
  210. url: './storeOrderDetail?id=' + item.id
  211. })
  212. },
  213. cancel(item){
  214. var that=this;
  215. uni.showModal({
  216. title: '提示',
  217. content: '确定取消订单吗',
  218. success: function (res) {
  219. if (res.confirm) {
  220. var data = {
  221. orderId:item.id
  222. };
  223. cancelOrder(data).then(res => {
  224. if(res.code==200){
  225. uni.showToast({
  226. icon:'success',
  227. title: "操作成功",
  228. });
  229. that.mescroll.resetUpScroll()
  230. }else{
  231. uni.showToast({
  232. icon:'none',
  233. title: res.msg,
  234. });
  235. }
  236. });
  237. }
  238. else if (res.cancel) {
  239. }
  240. }
  241. });
  242. },
  243. pay(item) {
  244. if(item.isPrescribe==1 && item.prescribeId==null){
  245. uni.navigateTo({
  246. url:"/pages/shopping/prescribe?orderId="+item.id
  247. });
  248. }
  249. else{
  250. uni.navigateTo({
  251. // url: '/pages_mall/newArrival?orderId='+item.id
  252. url: '/pages_mall/paymentOrder?orderId='+item.id
  253. })
  254. // uni.navigateTo({
  255. // // url: '/pages/store/packageOrderPay?orderId='+item.id
  256. // url: '/pages_mall/paymentOrder?orderId='+item.id
  257. // })
  258. }
  259. },
  260. // 查看物流
  261. showDelivery(item) {
  262. uni.navigateTo({
  263. url: './storeOrderDelivery?orderId='+item.id
  264. })
  265. }
  266. }
  267. }
  268. </script>
  269. <style lang="scss">
  270. .top-fixed{
  271. width: 100%;
  272. position: fixed;
  273. top: 0;
  274. left: 0;
  275. z-index: 10;
  276. }
  277. .pub-tab-box{
  278. box-sizing: border-box;
  279. width: 100%;
  280. padding: 0 40upx;
  281. background-color: #FFFFFF;
  282. .tab-inner{
  283. height: 88upx;
  284. line-height: 88upx;
  285. display: flex;
  286. align-items: center;
  287. justify-content: space-between;
  288. overflow-x: auto;
  289. }
  290. .item{
  291. font-size: 28upx;
  292. white-space: nowrap;
  293. line-height: 1;
  294. font-family: PingFang SC;
  295. font-weight: 500;
  296. color: #666666;
  297. margin-right: 60upx;
  298. display: flex;
  299. align-items: center;
  300. justify-content: center;
  301. &:last-child{
  302. margin-right: 0;
  303. }
  304. &.active{
  305. font-weight: bold;
  306. color: #333333;
  307. }
  308. .text{
  309. position: relative;
  310. z-index: 1;
  311. }
  312. .tab-bg{
  313. width: 72upx;
  314. height: 28upx;
  315. position: absolute;
  316. top: 17upx;
  317. left: 50%;
  318. transform: translateX(-36upx);
  319. z-index: -1;
  320. }
  321. }
  322. }
  323. .top-seat{
  324. width: 100%;
  325. height: 192upx;
  326. }
  327. .search-cont{
  328. padding: 16upx 30upx;
  329. background-color: #FFFFFF;
  330. .inner{
  331. box-sizing: border-box;
  332. width: 100%;
  333. height: 72upx;
  334. background: #F7F7F7;
  335. border-radius: 36upx;
  336. display: flex;
  337. align-items: center;
  338. padding: 0 30upx;
  339. .icon-search{
  340. width: 28upx;
  341. height: 28upx;
  342. margin-right: 20upx;
  343. }
  344. input{
  345. height: 60upx;
  346. line-height: 60upx;
  347. flex: 1;
  348. }
  349. }
  350. }
  351. .order-list{
  352. padding: 20upx;
  353. .item{
  354. background: #FFFFFF;
  355. border-radius: 16upx;
  356. padding: 0 30upx;
  357. margin-bottom: 20upx;
  358. .ordersn-box{
  359. display: flex;
  360. align-items: center;
  361. justify-content: space-between;
  362. padding: 34upx 0 20upx;
  363. .num{
  364. font-size: 26upx;
  365. font-family: PingFang SC;
  366. font-weight: 500;
  367. color: #999999;
  368. line-height: 1;
  369. }
  370. .status-box{
  371. display: flex;
  372. align-items: center;
  373. .recom-box{
  374. width: 108upx;
  375. height: 30upx;
  376. line-height: 30upx;
  377. text-align: left;
  378. padding-left: 8upx;
  379. font-size: 22upx;
  380. font-family: PingFang SC;
  381. font-weight: 500;
  382. color: #FFFFFF;
  383. background-image: url(https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/recom.png);
  384. background-repeat: no-repeat;
  385. background-size: 100% 100%;
  386. margin-right: 8upx;
  387. }
  388. .text{
  389. font-size: 28upx;
  390. font-family: PingFang SC;
  391. font-weight: 500;
  392. line-height: 1;
  393. &.success{
  394. color: #2583EB;
  395. }
  396. &.black{
  397. color: #111111;
  398. }
  399. &.info{
  400. color: #999999;
  401. }
  402. }
  403. }
  404. }
  405. .drug-list{
  406. .drug-item{
  407. padding: 30upx 0;
  408. border-bottom: 1px soli #F0F0F0;
  409. display: flex;
  410. align-items: center;
  411. .img-box{
  412. width: 160upx;
  413. height: 160upx;
  414. margin-right: 30upx;
  415. flex-shrink: 0;
  416. image{
  417. width: 100%;
  418. height: 100%;
  419. }
  420. }
  421. .drug-info{
  422. width: calc(100% - 190upx);
  423. height: 160upx;
  424. display: flex;
  425. flex-direction: column;
  426. justify-content: space-between;
  427. .name-box{
  428. font-size: 28upx;
  429. font-family: PingFang SC;
  430. font-weight: 500;
  431. color: #111111;
  432. line-height: 40upx;
  433. .tag{
  434. display: inline-block;
  435. padding: 0 6upx;
  436. height: 30upx;
  437. background: linear-gradient(90deg, #66b2ef 0%, #2583EB 100%);
  438. border-radius: 4upx;
  439. margin-right: 10upx;
  440. font-size: 22upx;
  441. font-family: PingFang SC;
  442. font-weight: bold;
  443. color: #FFFFFF;
  444. line-height: 30upx;
  445. float: left;
  446. margin-top: 7upx;
  447. }
  448. }
  449. .spec{
  450. font-size: 24upx;
  451. font-family: PingFang SC;
  452. font-weight: 500;
  453. color: #999999;
  454. line-height: 1;
  455. margin-top: 10upx;
  456. }
  457. .num-box{
  458. display: flex;
  459. align-items: center;
  460. justify-content: space-between;
  461. .price{
  462. display: flex;
  463. align-items: flex-end;
  464. .unit{
  465. font-size: 24upx;
  466. font-family: PingFang SC;
  467. font-weight: 500;
  468. color: #111111;
  469. line-height: 1.2;
  470. margin-right: 4upx;
  471. }
  472. .num{
  473. font-size: 32upx;
  474. font-family: PingFang SC;
  475. font-weight: 500;
  476. color: #111111;
  477. line-height: 1;
  478. }
  479. }
  480. .amount{
  481. font-size: 24upx;
  482. font-family: PingFang SC;
  483. font-weight: 500;
  484. color: #999999;
  485. line-height: 1;
  486. }
  487. }
  488. }
  489. }
  490. .bottom-box{
  491. height: 110upx;
  492. display: flex;
  493. align-items: center;
  494. justify-content: space-between;
  495. .amount-paid{
  496. display: flex;
  497. align-items: center;
  498. .label{
  499. font-size: 24upx;
  500. font-family: PingFang SC;
  501. font-weight: 500;
  502. color: #999999;
  503. line-height: 1;
  504. }
  505. .price-box{
  506. display: flex;
  507. align-items: flex-end;
  508. .unit{
  509. font-size: 24upx;
  510. font-family: PingFang SC;
  511. font-weight: 500;
  512. color: #FF6633;
  513. line-height: 1.2;
  514. margin-right: 4upx;
  515. }
  516. .num{
  517. font-size: 32upx;
  518. font-family: PingFang SC;
  519. font-weight: bold;
  520. color: #FF6633;
  521. line-height: 1;
  522. }
  523. }
  524. }
  525. .btn-box{
  526. box-sizing: border-box;
  527. display: flex;
  528. align-items: center;
  529. .btn{
  530. width: 155upx;
  531. height: 64upx;
  532. line-height: 64upx;
  533. font-size: 26upx;
  534. font-family: PingFang SC;
  535. font-weight: 500;
  536. text-align: center;
  537. border-radius: 32upx;
  538. margin-left: 15upx;
  539. &:first-child{
  540. margin-left: 0;
  541. }
  542. &.cancel{
  543. border: 1px solid #DDDDDD;
  544. color: #666666;
  545. }
  546. &.pay{
  547. background: #2583EB;
  548. color: #FFFFFF;
  549. }
  550. }
  551. }
  552. }
  553. }
  554. }
  555. }
  556. </style>