storeOrder.vue 13 KB

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