storeOrder.vue 15 KB

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