storeOrder.vue 14 KB

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