storeOrder.vue 14 KB

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