storeOrder.vue 15 KB

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