123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489 |
- <template>
- <view>
- <view class="top-fixed">
- <u-tabs
- :scrollable="false"
- :list="tabs"
- lineColor="#C39A58"
- @change="tabChange">
- </u-tabs>
- </view>
- <!-- 订单列表 -->
- <mescroll-body top="88rpx" bottom="0" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
- <view class="order-list">
- <view v-for="(item,index) in dataList" :key="index" class="item" >
- <!-- 订单号,状态 -->
- <view class="ordersn-box" @click="showDetail(item)">
- <view class="num">订单号:{{item.orderCode}}</view>
- <view class="status-box">
- <text class="text info" v-if="item.status==1">
- {{$getDictLabelName(orderStatusOptions,item.status)}}
- </text>
- <text class="text success" v-if="item.status>1">
- {{$getDictLabelName(orderStatusOptions,item.status)}}
- </text>
- <text class="text info" v-if="item.status<0">
- {{$getDictLabelName(orderStatusOptions,item.status)}}
- </text>
- </view>
- </view>
- <!-- 药品列表 -->
- <view class="drug-list" >
- <view @click="showDetail(item)" v-for="(subItem,subIndex) in item.items" :key="subIndex" class="drug-item" >
- <view class="img-box">
- <image :src="JSON.parse(subItem.jsonInfo).image==''?'/static/images/drug.svg':JSON.parse(subItem.jsonInfo).image" mode="aspectFill"></image>
-
- </view>
- <view class="drug-info" >
- <view>
- <view class="name-box ellipsis2">
- {{JSON.parse(subItem.jsonInfo).productName}}
- </view>
- <view class="spec ellipsis2">{{JSON.parse(subItem.jsonInfo).sku}}</view>
- </view>
- <view class="num-box">
- <view class="price">
- <!-- <text class="unit">¥</text> -->
- <!-- <text class="num" v-if="JSON.parse(subItem.jsonInfo).price!=null">{{JSON.parse(subItem.jsonInfo).price.toFixed(2)}}</text> -->
- </view>
- <view class="amount" v-if="item.ordetType==1">x{{JSON.parse(subItem.jsonInfo).num}}</view>
- </view>
- </view>
- </view>
- <!-- 实付金额、按钮 -->
- <view class="bottom-box">
- <view class="amount-paid">
- <text class="label">订单金额:</text>
- <view class="price-box">
- <view class="unit">¥</view>
- <view class="num" >{{item.payPrice.toFixed(2)}}</view>
- </view>
- </view>
- <view class="btn-box">
- <!-- <view class="btn cancel">
- 联系客服
- <button class='contact-btn' open-type="contact">
- </button>
- </view> -->
- <view v-if="item.status == 1" class="btn cancel" @click="cancel(item)">取消订单</view>
- <view v-if="item.status == 1" class="btn pay" @click="pay(item)">支付</view>
- <!-- <view v-if="item.isAfterSales==1" class="btn cancel" @click="refund(item)">申请售后</view> -->
- <!-- <view v-if="item.deliverySn!=null" class="btn pay" @click.stop="showDelivery(item)">查看物流</view> -->
- <view class="btn pay" v-if="item.status==3" @click="finish(item)">确认收货</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- </template>
- <script>
- import {getDictByKey} from '@/api/common.js'
- import {getMyStoreOrderList,cancelOrder,finishOrder} from '@/api/storeOrder'
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin],
- data() {
- return {
- orderStatusOptions:[],
- searchKey:"",
- status:"0",
- tabs: [
- {name:"全部",id:"0"},
- {name:"待付款",id:"1"},
- {name:"待发货",id:"2"},
- {name:"待收货",id:"3"},
- {name:"已完成",id:"4"}
- ],
- mescroll:null,
- // 上拉加载的配置
- upOption: {
- onScroll:false,
- use: true, // 是否启用上拉加载; 默认true
- page: {
- pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- size: 10 // 每页数据的数量,默认10
- },
- noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- textNoMore:"已经到底了",
- empty: {
- icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
- tip: '暂无数据'
- }
- },
- // 列表数据
- dataList: []
- };
- },
- onLoad(option) {
- var that=this;
- uni.$on('refreshStoreOrder', () => {
- that.mescroll.resetUpScroll()
- })
- this.getDictByKey("sys_order_status");
- },
- methods: {
-
- getDictByKey(key){
- var data={key:key}
- getDictByKey(data).then(
- res => {
- if(res.code==200){
- if(key=="sys_order_status"){
- this.orderStatusOptions=res.data;
- }
- }
- },
- err => {
- }
- );
-
- },
- goSearch(e) {
- this.searchKey=e.detail.value;
- this.mescroll.resetUpScroll()
- },
- refund(item) {
- uni.navigateTo({
- url: '/pages_order/storeOrderRefundApply?orderId='+item.orderId
- })
- },
- tabChange(item) {
- this.status = item.id
- this.mescroll.resetUpScroll()
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- /*下拉刷新的回调 */
- downCallback(mescroll) {
- mescroll.resetUpScroll()
- },
- upCallback(page) {
- //联网加载数据
- var that = this;
- var data = {
- keyword:this.searchKey,
- status:this.status,
- pageNum: page.num,
- pageSize: page.size
- };
- getMyStoreOrderList(data).then(res => {
- if(res.code==200){
- //设置列表数据
- res.data.list.forEach(function(value, index, array){
- value.items=JSON.parse(value.itemJson)
- })
- if (page.num == 1) {
- that.dataList = res.data.list;
-
- } else {
- that.dataList = that.dataList.concat(res.data.list);
-
- }
- that.mescroll.endBySize(res.data.list.length, res.data.total);
-
- }else{
- uni.showToast({
- icon:'none',
- title: "请求失败",
- });
- that.dataList = null;
- that.mescroll.endErr();
- }
- });
- },
- // 查看订单详情
- showDetail(item) {
- uni.navigateTo({
- url: './storeOrderDetail?orderId=' + item.orderId
- })
- },
- finish(item){
- var that=this;
- uni.showModal({
- title: '提示',
- content: '确定已收货吗',
- success: function (res) {
- if (res.confirm) {
- var data = {
- orderId:item.orderId
- };
- finishOrder(data).then(res => {
- if(res.code==200){
- uni.showToast({
- icon:'success',
- title: "操作成功",
- });
- that.mescroll.resetUpScroll()
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- });
- }
- else if (res.cancel) {
- }
- }
- });
- },
- cancel(item){
- var that=this;
- uni.showModal({
- title: '提示',
- content: '确定取消订单吗',
- success: function (res) {
- if (res.confirm) {
- var data = {
- orderId:item.orderId
- };
- cancelOrder(data).then(res => {
- if(res.code==200){
- uni.showToast({
- icon:'success',
- title: "操作成功",
- });
- that.mescroll.resetUpScroll()
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- });
- }
- else if (res.cancel) {
- }
- }
- });
- },
- pay(item) {
- uni.navigateTo({
- url: '/pages_order/storeOrderPay?orderId='+item.orderId
- })
- },
- // 查看物流
- showDelivery(item) {
- uni.navigateTo({
- url: './storeOrderDelivery?orderId='+item.orderId
- })
- }
-
- }
- }
- </script>
- <style lang="scss">
- .top-fixed{
- width: 100%;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 10;
- height: 88upx;
- background-color: #fff;
- }
- .order-list{
- padding: 20upx;
- .item{
- background: #FFFFFF;
- border-radius: 16upx;
- padding: 0 30upx;
- margin-bottom: 20upx;
- .ordersn-box{
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 34upx 0 20upx;
- .num{
- font-size: 26upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- line-height: 1;
- }
- .status-box{
- display: flex;
- align-items: center;
- .text{
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: 500;
- line-height: 1;
- &.success{
- color: #C39A58;
- }
- &.black{
- color: #111111;
- }
- &.info{
- color: #999999;
- }
- }
- }
- }
- .drug-list{
- .drug-item{
- padding: 30upx 0;
- border-bottom: 1px soli #F0F0F0;
- display: flex;
- align-items: center;
- .img-box{
- width: 160upx;
- height: 160upx;
- margin-right: 30upx;
- flex-shrink: 0;
- image{
- width: 100%;
- height: 100%;
- }
- }
- .drug-info{
- width: calc(100% - 190upx);
- height: 160upx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .name-box{
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- line-height: 40upx;
- .tag{
- display: inline-block;
- padding: 0 6upx;
- height: 30upx;
- background: linear-gradient(90deg, #C39A58 0%, #E2C99E 100%);
- border-radius: 4upx;
- margin-right: 10upx;
- font-size: 22upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FFFFFF;
- line-height: 30upx;
- float: left;
- margin-top: 7upx;
- }
- }
- .spec{
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- line-height: 1;
- margin-top: 10upx;
- }
- .num-box{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .price{
- display: flex;
- align-items: flex-end;
- .unit{
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- line-height: 1.2;
- margin-right: 4upx;
- }
- .num{
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- line-height: 1;
- }
- }
- .amount{
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- line-height: 1;
- }
- }
- }
- }
- .bottom-box{
- height: 110upx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .amount-paid{
- display: flex;
- align-items: center;
- .label{
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- line-height: 1;
- }
- .price-box{
- display: flex;
- align-items: flex-end;
- .unit{
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FF6633;
- line-height: 1.2;
- margin-right: 4upx;
- }
- .num{
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FF6633;
- line-height: 1;
- }
- }
- }
- .btn-box{
- box-sizing: border-box;
- display: flex;
- align-items: center;
- .btn{
- position: relative;
- width: 155upx;
- height: 64upx;
- line-height: 64upx;
- font-size: 26upx;
- font-family: PingFang SC;
- font-weight: 500;
- text-align: center;
- border-radius: 32upx;
- margin-left: 15upx;
- &:first-child{
- margin-left: 0;
- }
- &.cancel{
- border: 1px solid #DDDDDD;
- color: #666666;
- }
- &.pay{
- background: #C39A58;
- color: #FFFFFF;
- }
- .contact-btn {
- top: 0;
- position: absolute;
- width:100%;
- height:100%;
- opacity: 0;
- }
- }
- }
- }
- }
- }
- }
-
- </style>
|