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. // console.log(res)
  186. } else {
  187. that.dataList = that.dataList.concat(res.data.list);
  188. }
  189. that.mescroll.endBySize(res.data.list.length, res.data.total);
  190. }else{
  191. uni.showToast({
  192. icon:'none',
  193. title: "请求失败",
  194. });
  195. that.dataList = null;
  196. that.mescroll.endErr();
  197. }
  198. });
  199. },
  200. // 查看订单详情
  201. showDetail(item) {
  202. console.log(item)
  203. uni.navigateTo({
  204. url: './storeOrderDetail?id=' + item.id
  205. })
  206. },
  207. cancel(item){
  208. var that=this;
  209. uni.showModal({
  210. title: '提示',
  211. content: '确定取消订单吗',
  212. success: function (res) {
  213. if (res.confirm) {
  214. var data = {
  215. orderId:item.id
  216. };
  217. cancelOrder(data).then(res => {
  218. if(res.code==200){
  219. uni.showToast({
  220. icon:'success',
  221. title: "操作成功",
  222. });
  223. that.mescroll.resetUpScroll()
  224. }else{
  225. uni.showToast({
  226. icon:'none',
  227. title: res.msg,
  228. });
  229. }
  230. });
  231. }
  232. else if (res.cancel) {
  233. }
  234. }
  235. });
  236. },
  237. pay(item) {
  238. uni.navigateTo({
  239. url: '/pages/shopping/paymentOrder?orderId='+item.id
  240. })
  241. },
  242. // 查看物流
  243. showDelivery(item) {
  244. uni.navigateTo({
  245. url: './storeOrderDelivery?orderId='+item.id
  246. })
  247. }
  248. }
  249. }
  250. </script>
  251. <style lang="scss">
  252. .top-fixed{
  253. width: 100%;
  254. position: fixed;
  255. top: 0;
  256. left: 0;
  257. z-index: 10;
  258. }
  259. .pub-tab-box{
  260. box-sizing: border-box;
  261. width: 100%;
  262. padding: 0 40upx;
  263. background-color: #FFFFFF;
  264. .tab-inner{
  265. height: 88upx;
  266. line-height: 88upx;
  267. display: flex;
  268. align-items: center;
  269. justify-content: space-between;
  270. overflow-x: auto;
  271. }
  272. .item{
  273. font-size: 28upx;
  274. white-space: nowrap;
  275. line-height: 1;
  276. font-family: PingFang SC;
  277. font-weight: 500;
  278. color: #666666;
  279. margin-right: 60upx;
  280. display: flex;
  281. align-items: center;
  282. justify-content: center;
  283. &:last-child{
  284. margin-right: 0;
  285. }
  286. &.active{
  287. font-weight: bold;
  288. color: #333333;
  289. }
  290. .text{
  291. position: relative;
  292. z-index: 1;
  293. }
  294. .tab-bg{
  295. width: 72upx;
  296. height: 28upx;
  297. position: absolute;
  298. top: 17upx;
  299. left: 50%;
  300. transform: translateX(-36upx);
  301. z-index: -1;
  302. }
  303. }
  304. }
  305. .top-seat{
  306. width: 100%;
  307. height: 192upx;
  308. }
  309. .search-cont{
  310. padding: 16upx 30upx;
  311. background-color: #FFFFFF;
  312. .inner{
  313. box-sizing: border-box;
  314. width: 100%;
  315. height: 72upx;
  316. background: #F7F7F7;
  317. border-radius: 36upx;
  318. display: flex;
  319. align-items: center;
  320. padding: 0 30upx;
  321. .icon-search{
  322. width: 28upx;
  323. height: 28upx;
  324. margin-right: 20upx;
  325. }
  326. input{
  327. height: 60upx;
  328. line-height: 60upx;
  329. flex: 1;
  330. }
  331. }
  332. }
  333. .order-list{
  334. padding: 20upx;
  335. .item{
  336. background: #FFFFFF;
  337. border-radius: 16upx;
  338. padding: 0 30upx;
  339. margin-bottom: 20upx;
  340. .ordersn-box{
  341. display: flex;
  342. align-items: center;
  343. justify-content: space-between;
  344. padding: 34upx 0 20upx;
  345. .num{
  346. font-size: 26upx;
  347. font-family: PingFang SC;
  348. font-weight: 500;
  349. color: #999999;
  350. line-height: 1;
  351. }
  352. .status-box{
  353. display: flex;
  354. align-items: center;
  355. .recom-box{
  356. width: 108upx;
  357. height: 30upx;
  358. line-height: 30upx;
  359. text-align: left;
  360. padding-left: 8upx;
  361. font-size: 22upx;
  362. font-family: PingFang SC;
  363. font-weight: 500;
  364. color: #FFFFFF;
  365. background-image: url(../../static/images/recom.png);
  366. background-repeat: no-repeat;
  367. background-size: 100% 100%;
  368. margin-right: 8upx;
  369. }
  370. .text{
  371. font-size: 28upx;
  372. font-family: PingFang SC;
  373. font-weight: 500;
  374. line-height: 1;
  375. &.success{
  376. color: #2BC7B9;
  377. }
  378. &.black{
  379. color: #111111;
  380. }
  381. &.info{
  382. color: #999999;
  383. }
  384. }
  385. }
  386. }
  387. .drug-list{
  388. .drug-item{
  389. padding: 30upx 0;
  390. border-bottom: 1px soli #F0F0F0;
  391. display: flex;
  392. align-items: center;
  393. .img-box{
  394. width: 160upx;
  395. height: 160upx;
  396. margin-right: 30upx;
  397. flex-shrink: 0;
  398. image{
  399. width: 100%;
  400. height: 100%;
  401. }
  402. }
  403. .drug-info{
  404. width: calc(100% - 190upx);
  405. height: 160upx;
  406. display: flex;
  407. flex-direction: column;
  408. justify-content: space-between;
  409. .name-box{
  410. font-size: 28upx;
  411. font-family: PingFang SC;
  412. font-weight: 500;
  413. color: #111111;
  414. line-height: 40upx;
  415. .tag{
  416. display: inline-block;
  417. padding: 0 6upx;
  418. height: 30upx;
  419. background: linear-gradient(90deg, #2BC7B9 0%, #2BC7A4 100%);
  420. border-radius: 4upx;
  421. margin-right: 10upx;
  422. font-size: 22upx;
  423. font-family: PingFang SC;
  424. font-weight: bold;
  425. color: #FFFFFF;
  426. line-height: 30upx;
  427. float: left;
  428. margin-top: 7upx;
  429. }
  430. }
  431. .spec{
  432. font-size: 24upx;
  433. font-family: PingFang SC;
  434. font-weight: 500;
  435. color: #999999;
  436. line-height: 1;
  437. margin-top: 10upx;
  438. }
  439. .num-box{
  440. display: flex;
  441. align-items: center;
  442. justify-content: space-between;
  443. .price{
  444. display: flex;
  445. align-items: flex-end;
  446. .unit{
  447. font-size: 24upx;
  448. font-family: PingFang SC;
  449. font-weight: 500;
  450. color: #111111;
  451. line-height: 1.2;
  452. margin-right: 4upx;
  453. }
  454. .num{
  455. font-size: 32upx;
  456. font-family: PingFang SC;
  457. font-weight: 500;
  458. color: #111111;
  459. line-height: 1;
  460. }
  461. }
  462. .amount{
  463. font-size: 24upx;
  464. font-family: PingFang SC;
  465. font-weight: 500;
  466. color: #999999;
  467. line-height: 1;
  468. }
  469. }
  470. }
  471. }
  472. .bottom-box{
  473. height: 110upx;
  474. display: flex;
  475. align-items: center;
  476. justify-content: space-between;
  477. .amount-paid{
  478. display: flex;
  479. align-items: center;
  480. .label{
  481. font-size: 24upx;
  482. font-family: PingFang SC;
  483. font-weight: 500;
  484. color: #999999;
  485. line-height: 1;
  486. }
  487. .price-box{
  488. display: flex;
  489. align-items: flex-end;
  490. .unit{
  491. font-size: 24upx;
  492. font-family: PingFang SC;
  493. font-weight: 500;
  494. color: #FF6633;
  495. line-height: 1.2;
  496. margin-right: 4upx;
  497. }
  498. .num{
  499. font-size: 32upx;
  500. font-family: PingFang SC;
  501. font-weight: bold;
  502. color: #FF6633;
  503. line-height: 1;
  504. }
  505. }
  506. }
  507. .btn-box{
  508. box-sizing: border-box;
  509. display: flex;
  510. align-items: center;
  511. .btn{
  512. width: 155upx;
  513. height: 64upx;
  514. line-height: 64upx;
  515. font-size: 26upx;
  516. font-family: PingFang SC;
  517. font-weight: 500;
  518. text-align: center;
  519. border-radius: 32upx;
  520. margin-left: 15upx;
  521. &:first-child{
  522. margin-left: 0;
  523. }
  524. &.cancel{
  525. border: 1px solid #DDDDDD;
  526. color: #666666;
  527. }
  528. &.pay{
  529. background: #2BC7B9;
  530. color: #FFFFFF;
  531. }
  532. }
  533. }
  534. }
  535. }
  536. }
  537. }
  538. </style>