storeOrder.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  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" @click="shoppingGoods(subItem)">
  47. <image :src="JSON.parse(subItem.jsonInfo).image" mode="aspectFill"></image>
  48. </view>
  49. <view class="drug-info" @click="shoppingGoods(subItem)">
  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. 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. uni.navigateTo({
  250. url: '/pages_shopping/paymentOrder?orderId='+item.id
  251. })
  252. },
  253. // 查看物流
  254. showDelivery(item) {
  255. uni.navigateTo({
  256. url: './storeOrderDelivery?orderId='+item.id
  257. })
  258. },
  259. showEvaluate(url) {
  260. uni.navigateTo({
  261. url: url
  262. })
  263. },
  264. addPrescribe(item){
  265. orderPrescription(item.id).then(res=>{
  266. if(res.code == 200) {
  267. // {status:状态 0未开放,跳转填写信息界面。 1开方中,跳转医生开方界面 2开方完成,跳转到支付,jumpLink:status为1时用这个跳转连接}
  268. if(res.data.status == 0) {
  269. uni.navigateTo({
  270. url:"/pages_shopping/prescribe?orderId="+item.id
  271. })
  272. } else if(res.data.status == 1) {
  273. uni.navigateTo({
  274. url: '/pages/index/webview?url='+encodeURIComponent(res.data.jumpLink)
  275. })
  276. } else if(res.data.status == 2) {
  277. uni.navigateTo({
  278. url: '/pages_shopping/paymentOrder?orderId='+item.id
  279. })
  280. }
  281. }
  282. })
  283. }
  284. }
  285. }
  286. </script>
  287. <style lang="scss">
  288. .storeName{
  289. color: #666;
  290. font-size: 28rpx;
  291. }
  292. .top-fixed{
  293. width: 100%;
  294. position: fixed;
  295. top: 0;
  296. left: 0;
  297. z-index: 10;
  298. }
  299. .pub-tab-box{
  300. box-sizing: border-box;
  301. width: 100%;
  302. padding: 0 40upx;
  303. background-color: #FFFFFF;
  304. .tab-inner{
  305. height: 88upx;
  306. line-height: 88upx;
  307. display: flex;
  308. align-items: center;
  309. justify-content: space-between;
  310. overflow-x: auto;
  311. }
  312. .item{
  313. font-size: 28upx;
  314. white-space: nowrap;
  315. line-height: 1;
  316. font-family: PingFang SC;
  317. font-weight: 500;
  318. color: #666666;
  319. margin-right: 60upx;
  320. display: flex;
  321. align-items: center;
  322. justify-content: center;
  323. &:last-child{
  324. margin-right: 0;
  325. }
  326. &.active{
  327. font-weight: bold;
  328. color: #333333;
  329. }
  330. .text{
  331. position: relative;
  332. z-index: 1;
  333. }
  334. .tab-bg{
  335. width: 72upx;
  336. height: 28upx;
  337. position: absolute;
  338. top: 17upx;
  339. left: 50%;
  340. transform: translateX(-36upx);
  341. z-index: -1;
  342. }
  343. }
  344. }
  345. .top-seat{
  346. width: 100%;
  347. height: 192upx;
  348. }
  349. .search-cont{
  350. padding: 16upx 30upx;
  351. background-color: #FFFFFF;
  352. .inner{
  353. box-sizing: border-box;
  354. width: 100%;
  355. height: 72upx;
  356. background: #F7F7F7;
  357. border-radius: 36upx;
  358. display: flex;
  359. align-items: center;
  360. padding: 0 30upx;
  361. .icon-search{
  362. width: 28upx;
  363. height: 28upx;
  364. margin-right: 20upx;
  365. }
  366. input{
  367. height: 60upx;
  368. line-height: 60upx;
  369. flex: 1;
  370. }
  371. }
  372. }
  373. .order-list{
  374. padding: 20upx;
  375. .item{
  376. background: #FFFFFF;
  377. border-radius: 16upx;
  378. padding: 0 30upx;
  379. margin-bottom: 20upx;
  380. .ordersn-box{
  381. display: flex;
  382. align-items: center;
  383. justify-content: space-between;
  384. padding: 34upx 0 20upx;
  385. .num{
  386. font-size: 26upx;
  387. font-family: PingFang SC;
  388. font-weight: 500;
  389. color: #999999;
  390. line-height: 1;
  391. }
  392. .status-box{
  393. display: flex;
  394. align-items: center;
  395. .recom-box{
  396. width: 108upx;
  397. height: 30upx;
  398. line-height: 30upx;
  399. text-align: left;
  400. padding-left: 8upx;
  401. font-size: 22upx;
  402. font-family: PingFang SC;
  403. font-weight: 500;
  404. color: #FFFFFF;
  405. background-image: url('https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/recom.png');
  406. background-repeat: no-repeat;
  407. background-size: 100% 100%;
  408. margin-right: 8upx;
  409. }
  410. .text{
  411. font-size: 28upx;
  412. font-family: PingFang SC;
  413. font-weight: 500;
  414. line-height: 1;
  415. &.success{
  416. color: #2BC7B9;
  417. }
  418. &.black{
  419. color: #111111;
  420. }
  421. &.info{
  422. color: #999999;
  423. }
  424. }
  425. }
  426. }
  427. .drug-list{
  428. .drug-item{
  429. padding: 30upx 0;
  430. border-bottom: 1px soli #F0F0F0;
  431. display: flex;
  432. align-items: center;
  433. .img-box{
  434. width: 160upx;
  435. height: 160upx;
  436. margin-right: 30upx;
  437. flex-shrink: 0;
  438. image{
  439. width: 100%;
  440. height: 100%;
  441. }
  442. }
  443. .drug-info{
  444. width: calc(100% - 190upx);
  445. height: 160upx;
  446. display: flex;
  447. flex-direction: column;
  448. justify-content: space-between;
  449. .name-box{
  450. font-size: 28upx;
  451. font-family: PingFang SC;
  452. font-weight: 500;
  453. color: #111111;
  454. line-height: 40upx;
  455. .tag{
  456. display: inline-block;
  457. padding: 0 6upx;
  458. height: 30upx;
  459. background: linear-gradient(90deg, #2BC7B9 0%, #2BC7A4 100%);
  460. border-radius: 4upx;
  461. margin-right: 10upx;
  462. font-size: 22upx;
  463. font-family: PingFang SC;
  464. font-weight: bold;
  465. color: #FFFFFF;
  466. line-height: 30upx;
  467. float: left;
  468. margin-top: 7upx;
  469. }
  470. }
  471. .spec{
  472. font-size: 24upx;
  473. font-family: PingFang SC;
  474. font-weight: 500;
  475. color: #999999;
  476. line-height: 1;
  477. margin-top: 10upx;
  478. }
  479. .num-box{
  480. display: flex;
  481. align-items: center;
  482. justify-content: space-between;
  483. .price{
  484. display: flex;
  485. align-items: flex-end;
  486. .unit{
  487. font-size: 24upx;
  488. font-family: PingFang SC;
  489. font-weight: 500;
  490. color: #111111;
  491. line-height: 1.2;
  492. margin-right: 4upx;
  493. }
  494. .num{
  495. font-size: 32upx;
  496. font-family: PingFang SC;
  497. font-weight: 500;
  498. color: #111111;
  499. line-height: 1;
  500. }
  501. }
  502. .amount{
  503. font-size: 24upx;
  504. font-family: PingFang SC;
  505. font-weight: 500;
  506. color: #999999;
  507. line-height: 1;
  508. }
  509. }
  510. }
  511. }
  512. .bottom-box{
  513. height: 110upx;
  514. display: flex;
  515. align-items: center;
  516. justify-content: space-between;
  517. .amount-paid{
  518. display: flex;
  519. align-items: center;
  520. .label{
  521. font-size: 24upx;
  522. font-family: PingFang SC;
  523. font-weight: 500;
  524. color: #999999;
  525. line-height: 1;
  526. }
  527. .price-box{
  528. display: flex;
  529. align-items: flex-end;
  530. .unit{
  531. font-size: 24upx;
  532. font-family: PingFang SC;
  533. font-weight: 500;
  534. color: #FF6633;
  535. line-height: 1.2;
  536. margin-right: 4upx;
  537. }
  538. .num{
  539. font-size: 32upx;
  540. font-family: PingFang SC;
  541. font-weight: bold;
  542. color: #FF6633;
  543. line-height: 1;
  544. }
  545. }
  546. }
  547. .btn-box{
  548. box-sizing: border-box;
  549. display: flex;
  550. align-items: center;
  551. .btn{
  552. width: 155upx;
  553. height: 64upx;
  554. line-height: 64upx;
  555. font-size: 26upx;
  556. font-family: PingFang SC;
  557. font-weight: 500;
  558. text-align: center;
  559. border-radius: 32upx;
  560. margin-left: 15upx;
  561. &:first-child{
  562. margin-left: 0;
  563. }
  564. &.cancel{
  565. border: 1px solid #DDDDDD;
  566. color: #666666;
  567. }
  568. &.pay{
  569. background: #2BC7B9;
  570. color: #FFFFFF;
  571. }
  572. }
  573. }
  574. }
  575. }
  576. }
  577. }
  578. </style>