storeOrder.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  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>
  52. <view class="name-box ellipsis2">
  53. <view v-if="subItem.isPrescribe==1" class="tag">处方药</view>{{JSON.parse(subItem.jsonInfo).productName}}
  54. </view>
  55. <view class="spec ellipsis2">{{JSON.parse(subItem.jsonInfo).sku}}</view>
  56. </view>
  57. <view class="num-box">
  58. <view class="price">
  59. <text class="unit">¥</text>
  60. <text class="num">{{JSON.parse(subItem.jsonInfo).price.toFixed(2)}}</text>
  61. </view>
  62. <view class="amount">x{{JSON.parse(subItem.jsonInfo).num}}</view>
  63. </view>
  64. </view>
  65. </view>
  66. <view v-if="item.isPackage==1&&item.packageJson!=null" class="drug-item" @click="showDetail(item)">
  67. <view class="img-box">
  68. <image :src="JSON.parse(item.packageJson).imgUrl" mode="aspectFill"></image>
  69. </view>
  70. <view class="drug-info" >
  71. <view>
  72. <view class="name-box ellipsis2">
  73. <view class="tag">套餐</view>{{JSON.parse(item.packageJson).title}}
  74. </view>
  75. <view class="spec ellipsis2">{{JSON.parse(item.packageJson).descs}}</view>
  76. </view>
  77. <!-- <view class="num-box">
  78. <view class="price">
  79. <text class="unit">¥</text>
  80. <text class="num">{{JSON.parse(item.packageJson).payMoney.toFixed(2)}}</text>
  81. </view>
  82. <view class="amount"></view>
  83. </view> -->
  84. </view>
  85. </view>
  86. <!-- 实付金额、按钮 -->
  87. <view class="bottom-box">
  88. <view class="amount-paid">
  89. <text class="label">订单金额:</text>
  90. <view class="price-box">
  91. <view class="unit">¥</view>
  92. <view class="num" >{{item.payPrice.toFixed(2)}}</view>
  93. </view>
  94. </view>
  95. <view class="btn-box">
  96. <view v-if="item.status == 0" class="btn cancel" @click="cancel(item)">取消订单</view>
  97. <view v-if="item.status == 0" class="btn pay" @click="pay(item)">支付</view>
  98. <view v-if="item.isAfterSales==1" class="btn cancel" @click="refund(item)">申请售后</view>
  99. <view v-if="item.status >=2 &&item.deliveryId!=null" class="btn pay" @click.stop="showDelivery(item)">查看物流</view>
  100. <!-- <view v-if="item.status==4" class="btn pay">再次购买</view> -->
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </mescroll-body>
  107. </view>
  108. </template>
  109. <script>
  110. import {getMyStoreOrderList,cancelOrder} from '@/api/storeOrder'
  111. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  112. export default {
  113. mixins: [MescrollMixin],
  114. data() {
  115. return {
  116. searchKey:"",
  117. status:0,
  118. orderStatus: [
  119. {name:"全部",value:""},
  120. {name:"待付款",value:"0"},
  121. {name:"待发货",value:"1"},
  122. {name:"待收货",value:"2"},
  123. {name:"已完成",value:"3"}
  124. ],
  125. mescroll:null,
  126. // 上拉加载的配置
  127. upOption: {
  128. onScroll:true,
  129. use: true, // 是否启用上拉加载; 默认true
  130. page: {
  131. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  132. size: 10 // 每页数据的数量,默认10
  133. },
  134. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  135. empty: {
  136. icon:'/static/images/no_data.png',
  137. tip: '暂无数据'
  138. }
  139. },
  140. // 列表数据
  141. dataList: [],
  142. };
  143. },
  144. onLoad(option) {
  145. this.status = option.status
  146. var that=this;
  147. uni.$on('refreshOrder', () => {
  148. that.mescroll.resetUpScroll()
  149. });
  150. },
  151. methods: {
  152. goSearch(e) {
  153. this.searchKey=e.detail.value;
  154. this.mescroll.resetUpScroll()
  155. },
  156. refund(item) {
  157. uni.navigateTo({
  158. url: './refundOrderProduct?orderId='+item.id
  159. })
  160. },
  161. // tab切换
  162. orderStatusChange(item) {
  163. this.status = item.value
  164. this.mescroll.resetUpScroll()
  165. },
  166. mescrollInit(mescroll) {
  167. this.mescroll = mescroll;
  168. },
  169. /*下拉刷新的回调 */
  170. downCallback(mescroll) {
  171. mescroll.resetUpScroll()
  172. },
  173. upCallback(page) {
  174. //联网加载数据
  175. var that = this;
  176. var data = {
  177. keyword:this.searchKey,
  178. status:this.status,
  179. page: page.num,
  180. pageSize: page.size
  181. };
  182. getMyStoreOrderList(data).then(res => {
  183. if(res.code==200){
  184. //设置列表数据
  185. if (page.num == 1) {
  186. that.dataList = res.data.list;
  187. } else {
  188. that.dataList = that.dataList.concat(res.data.list);
  189. }
  190. that.mescroll.endBySize(res.data.list.length, res.data.total);
  191. }else{
  192. uni.showToast({
  193. icon:'none',
  194. title: "请求失败",
  195. });
  196. that.dataList = null;
  197. that.mescroll.endErr();
  198. }
  199. });
  200. },
  201. // 查看订单详情
  202. showDetail(item) {
  203. console.log(item)
  204. uni.navigateTo({
  205. url: './storeOrderDetail?id=' + item.id
  206. })
  207. },
  208. cancel(item){
  209. var that=this;
  210. uni.showModal({
  211. title: '提示',
  212. content: '确定取消订单吗',
  213. success: function (res) {
  214. if (res.confirm) {
  215. var data = {
  216. orderId:item.id
  217. };
  218. cancelOrder(data).then(res => {
  219. if(res.code==200){
  220. uni.showToast({
  221. icon:'success',
  222. title: "操作成功",
  223. });
  224. that.mescroll.resetUpScroll()
  225. }else{
  226. uni.showToast({
  227. icon:'none',
  228. title: res.msg,
  229. });
  230. }
  231. });
  232. }
  233. else if (res.cancel) {
  234. }
  235. }
  236. });
  237. },
  238. pay(item) {
  239. if(item.isPrescribe==1 && item.prescribeId==null){
  240. uni.navigateTo({
  241. url:"/pages/shopping/prescribe?orderId="+item.id
  242. });
  243. }
  244. else{
  245. uni.navigateTo({
  246. url: '/pages/shopping/paymentOrder?orderId='+item.id
  247. })
  248. }
  249. },
  250. // 查看物流
  251. showDelivery(item) {
  252. uni.navigateTo({
  253. url: './storeOrderDelivery?orderId='+item.id
  254. })
  255. }
  256. }
  257. }
  258. </script>
  259. <style lang="scss">
  260. .top-fixed{
  261. width: 100%;
  262. position: fixed;
  263. top: 0;
  264. left: 0;
  265. z-index: 10;
  266. }
  267. .pub-tab-box{
  268. box-sizing: border-box;
  269. width: 100%;
  270. padding: 0 40upx;
  271. background-color: #FFFFFF;
  272. .tab-inner{
  273. height: 88upx;
  274. line-height: 88upx;
  275. display: flex;
  276. align-items: center;
  277. justify-content: space-between;
  278. overflow-x: auto;
  279. }
  280. .item{
  281. font-size: 28upx;
  282. white-space: nowrap;
  283. line-height: 1;
  284. font-family: PingFang SC;
  285. font-weight: 500;
  286. color: #666666;
  287. margin-right: 60upx;
  288. display: flex;
  289. align-items: center;
  290. justify-content: center;
  291. &:last-child{
  292. margin-right: 0;
  293. }
  294. &.active{
  295. font-weight: bold;
  296. color: #333333;
  297. }
  298. .text{
  299. position: relative;
  300. z-index: 1;
  301. }
  302. .tab-bg{
  303. width: 72upx;
  304. height: 28upx;
  305. position: absolute;
  306. top: 17upx;
  307. left: 50%;
  308. transform: translateX(-36upx);
  309. z-index: -1;
  310. }
  311. }
  312. }
  313. .top-seat{
  314. width: 100%;
  315. height: 192upx;
  316. }
  317. .search-cont{
  318. padding: 16upx 30upx;
  319. background-color: #FFFFFF;
  320. .inner{
  321. box-sizing: border-box;
  322. width: 100%;
  323. height: 72upx;
  324. background: #F7F7F7;
  325. border-radius: 36upx;
  326. display: flex;
  327. align-items: center;
  328. padding: 0 30upx;
  329. .icon-search{
  330. width: 28upx;
  331. height: 28upx;
  332. margin-right: 20upx;
  333. }
  334. input{
  335. height: 60upx;
  336. line-height: 60upx;
  337. flex: 1;
  338. }
  339. }
  340. }
  341. .order-list{
  342. padding: 20upx;
  343. .item{
  344. background: #FFFFFF;
  345. border-radius: 16upx;
  346. padding: 0 30upx;
  347. margin-bottom: 20upx;
  348. .storeName {
  349. overflow: hidden;
  350. white-space: nowrap;
  351. text-overflow: ellipsis;
  352. font-size: 28rpx;
  353. font-family: PingFang SC;
  354. font-weight: 500;
  355. color: #111111;
  356. margin-bottom: 10rpx;
  357. }
  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(../../static/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: #018C39;
  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%, #018C39 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: #018C39;
  548. color: #FFFFFF;
  549. }
  550. }
  551. }
  552. }
  553. }
  554. }
  555. }
  556. </style>