storeOrder.vue 13 KB

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