计算购物车钱之前

This commit is contained in:
wwz
2025-02-26 17:39:46 +08:00
parent f2513ef13a
commit 0ab9235f6c
33 changed files with 4225 additions and 903 deletions

View File

@@ -14,15 +14,12 @@
defineProps
} from 'vue';
import {
APIproductqueryShop
} from "@/common/api/product/product.js";
import {
Storelogin
} from '@/stores/share.js';
productStore
} from '@/stores/user.js';
const props = defineProps({
district: Array
});
const clickdistrict = (item) => {
const clickdistrict = async (item) => {
switch (item.jumpType) {
case 'absolute':
uni.pro.navigateTo('webview/webview', {
@@ -36,47 +33,13 @@
uni.pro.navigateTo(item.absUrl);
break;
case 'scan':
// #ifndef H5
if (!uni.utils.pluschooseImage()) {
return false
}
// #ifdef APP || MP-WEIXIN || MP-ALIPAY
uni.scanCode({
success: async (res) => {
let tableCode = getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode)
if (tableCode) {
let data = await APIproductqueryShop({
code: uni.cache.get('tableCode'),
})
// -4请求登录
const store = Storelogin();
if (data.code == '-4') {
if (await store.actionslogin()) {
// 成功
} else {
// 失败接着请求
await store.actionslogin()
}
}
if (data.data.shopTableInfo && !data.data.shopTableInfo.choseCount) {
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: tableCode,
shopId: data.data.storeInfo.id,
})
} else {
uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode,
})
}
}
},
fail: (res) => {
console.log(res)
}
});
// #endif
const store = productStore();
await store.scanCodeactions()
break;
}
}

View File

@@ -186,8 +186,8 @@
const ordergetYhqParass = async () => {
let res = await APIordergetYhqPara()
try {
orderview.list = res.data
for (let i = 0; i <= res.data.length; i++) {
orderview.list = res
for (let i = 0; i <= res.length; i++) {
orderfindCouponses(i, orderview.list[i].name);
}
} catch (e) {
@@ -202,7 +202,7 @@
size: 10,
type: name
})
orderview.list[i].orderview.listdata = res.data.list
orderview.list[i].orderview.listdata = res.list
console.log(orderview.list)
}
const ordermineCouponsthis = async () => {
@@ -214,8 +214,8 @@
orderId: ''
})
try {
viewlist.totalnumber = res.data.total
viewlist.list = res.data.list.slice(0, 2)
viewlist.totalnumber = res.total
viewlist.list = res.list.slice(0, 2)
} catch (e) {
//TODO handle the exception
}
@@ -272,8 +272,8 @@
// async ordergetYhqParass() { //类型列表
// let res = await this.api.ordergetYhqPara()
// try {
// this.orderview.list = res.data
// for (let i = 0; i <= res.data.length; i++) {
// this.orderview.list = res
// for (let i = 0; i <= res.length; i++) {
// this.orderfindCouponses(i, this.orderview.list[i].name);
// }
// } catch (e) {
@@ -286,7 +286,7 @@
// size: 10,
// type: name
// })
// this.orderview.list[i].orderview.listdata = res.data.list
// this.orderview.list[i].orderview.listdata = res.list
// console.log(this.orderview.list)
// this.$forceUpdate();
// },
@@ -299,8 +299,8 @@
// orderId: ''
// })
// try {
// this.viewlist.totalnumber = res.data.total
// this.viewlist.list = res.data.list.slice(0, 2)
// this.viewlist.totalnumber = res.total
// this.viewlist.list = res.list.slice(0, 2)
// } catch (e) {
// //TODO handle the exception
// }

View File

@@ -12,129 +12,119 @@
<!-- 今日上线 -->
<todaylist :todayList='hometoplist.todayList' :salesList='hometoplist.salesList'></todaylist>
<!-- 类目 -->
<!-- #ifdef MP-WEIXIN -->
<!-- 只有小程序需要加height -->
<up-sticky :offset-top="store.height">
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<up-sticky>
<!-- #endif -->
<view class="fourcontent" id="fourcontent">
<view class="flex-between" style="flex-wrap: inherit;">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu"
:key="index" @click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text style="margin-right: 10rpx;">{{item.name}}</text>
<up-icon v-if="item.isChild" style="margin-left: 10rpx;"
:name="showproductlist && viewHistoryindex == index ?'arrow-up-fill':'arrow-down-fill'"
color="#333333" size="12"></up-icon>
</view>
</view>
<view class="componentsclass" v-if="showproductlist">
<AreaSelect v-if="viewHistoryindex == 0" @updateValue="openproductlist" />
<grouping v-if="viewHistoryindex == 1 || viewHistoryindex == 2 || viewHistoryindex == 3"
@grouping="openproductlist" />
</view>
<view :style="{'top':store.height+'px'}" class="fourcontent" id="fourcontent">
<view class="flex-between" style="flex-wrap: inherit;">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu" :key="index"
@click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text style="margin-right: 10rpx;">{{item.name}}</text>
<up-icon v-if="item.isChild" style="margin-left: 10rpx;"
:name="showproductlist && viewHistoryindex == index ?'arrow-up-fill':'arrow-down-fill'"
color="#333333" size="12"></up-icon>
</view>
</up-sticky>
<!-- 首页抢购区域 -->
<view class="fivecontent">
<view class="fivecontent_item" v-for="(item,index) in homelist" :key="index"
@click="fivecontentclick(item)">
<view class="fivecontent_item_nav flex-start">
<image :src="item.shopImage" mode="aspectFill"></image>
<view class="fivecontent_item_nav_left">
<view class="fivecontent_item_nav_lefttop flex-between">
<view>
{{item.shopName}}
</view>
<view>
{{item.districts}}&nbsp;{{item.distances}}
</view>
</view>
<view class="fivecontent_item_nav_lefttopstart flex-start">
<view class="fivecontent_item_nav_leftlang flex-start"
v-for="(s,index1) in item.shopTag" :key="index1"
:style="{'background':s.backColor,'color':s.backColor}">
<image class="fivecontent_item_nav_leftlangimage" v-if="s.shareImg"
:src="s.shareImg" mode="aspectFill"></image>
<text class="fivecontent_item_nav_leftlangtext">{{s.name}}</text>
</view>
</view>
</view>
</view>
<view class="fivecontent_item_box">
<view class="fivecontent_item_boxitem flex-between">
<image :src="`${item.image}?x-oss-process=image/resize,m_lfit,w_192,h_192`"
mode="aspectFill"></image>
<view class="fivecontent_item_boxitemleft flex-colum-start">
<view class="fivecontent_item_boxitemleftone flex-between"
style="display: flex;justify-content: space-between;align-items: center;">
<view>
{{item.productName.length>7?item.productName.substring(0,7)+'...':item.productName}}
</view>
<text>已抢{{item.realSalesNumber}}</text>
</view>
<view class="flex-start flexstartboxfttow">
<view class="fivecontent_item_boxitemlefttow flex-start"
v-for="(c,index2) in item.proTag" :key="index2"
:style="{'background':c.backColor,'color':c.backColor}">
<image class="fivecontent_item_boxitemlefttowimage" v-if="c.shareImg"
:src="c.shareImg" mode="aspectFill"></image>
<text class="fivecontent_item_boxitemlefttowtext">{{c.name}}</text>
</view>
</view>
<view class="indexboxitemleftthere flex-colum-start">
<view class="indexboxitemleftthereabsolute">
马上抢
</view>
<view class="indexboxitemlefttheretext flex-start">
<view class="fivecontent_item_boxitemlefthere_one flex-start">
<text class="flex_startone">到手</text>
<text class="flex_starttow">¥{{item.salePrice}}</text>
</view>
<view class="fivecontent_item_boxitemlefthere_tow">
{{item.discount || ''}}
</view>
<view class="fivecontent_item_boxitemlefthere_there">
¥{{item.originPrice}}
</view>
</view>
<view class="indexboxitemleftthere_countdown flex-between">
<text class="indexboxitemleftthere_countdowntext">共省{{item.save}}</text>
<view class="indexboxitemleftthere_countdowntexts">
<up-count-down
:time="item.end_times.d * item.end_times.h * item.end_times.m *item.end_times.s"
format="HH:mm:ss" autoStart millisecond @change="onChange">
<view class="time">
<view class="time__custom">
<text
class="time__custom__item">{{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}</text>
</view>
<text class="time__doc">:</text>
<view class="time__custom">
<text
class="time__custom__item">{{ timeData.minutes>10?timeData.minutes:'0'+timeData.minutes }}</text>
</view>
<text class="time__doc">:</text>
<view class="time__custom">
<text
class="time__custom__item">{{ timeData.seconds>10?timeData.seconds:'0'+timeData.seconds }}</text>
</view>
</view>
</up-count-down>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<up-loadmore height='40' :status="formhomelist.status" iconSize='16' fontSize='16' />
</view>
<view class="componentsclass" v-if="showproductlist">
<AreaSelect v-if="viewHistoryindex == 0" @updateValue="openproductlist" />
<grouping v-if="viewHistoryindex == 1 || viewHistoryindex == 2 || viewHistoryindex == 3"
@grouping="openproductlist" />
</view>
</view>
<!-- 首页抢购区域 -->
<view class="fivecontent">
<view class="fivecontent_item" v-for="(item,index) in homelist" :key="index"
@click="fivecontentclick(item)">
<view class="fivecontent_item_nav flex-start">
<image :src="item.shopImage" mode="aspectFill"></image>
<view class="fivecontent_item_nav_left">
<view class="fivecontent_item_nav_lefttop flex-between">
<view>
{{item.shopName}}
</view>
<view>
{{item.districts}}&nbsp;{{item.distances}}
</view>
</view>
<view class="fivecontent_item_nav_lefttopstart flex-start">
<view class="fivecontent_item_nav_leftlang flex-start"
v-for="(s,index1) in item.shopTag" :key="index1"
:style="{'background':s.backColor,'color':s.backColor}">
<image class="fivecontent_item_nav_leftlangimage" v-if="s.shareImg"
:src="s.shareImg" mode="aspectFill"></image>
<text class="fivecontent_item_nav_leftlangtext">{{s.name}}</text>
</view>
</view>
</view>
</view>
<view class="fivecontent_item_box">
<view class="fivecontent_item_boxitem flex-between">
<image :src="`${item.image}?x-oss-process=image/resize,m_lfit,w_192,h_192`"
mode="aspectFill"></image>
<view class="fivecontent_item_boxitemleft flex-colum-start">
<view class="fivecontent_item_boxitemleftone flex-between"
style="display: flex;justify-content: space-between;align-items: center;">
<view>
{{item.productName.length>7?item.productName.substring(0,7)+'...':item.productName}}
</view>
<text>已抢{{item.realSalesNumber}}</text>
</view>
<view class="flex-start flexstartboxfttow">
<view class="fivecontent_item_boxitemlefttow flex-start"
v-for="(c,index2) in item.proTag" :key="index2"
:style="{'background':c.backColor,'color':c.backColor}">
<image class="fivecontent_item_boxitemlefttowimage" v-if="c.shareImg"
:src="c.shareImg" mode="aspectFill"></image>
<text class="fivecontent_item_boxitemlefttowtext">{{c.name}}</text>
</view>
</view>
<view class="indexboxitemleftthere flex-colum-start">
<view class="indexboxitemleftthereabsolute">
马上抢
</view>
<view class="indexboxitemlefttheretext flex-start">
<view class="fivecontent_item_boxitemlefthere_one flex-start">
<text class="flex_startone">到手</text>
<text class="flex_starttow">¥{{item.salePrice}}</text>
</view>
<view class="fivecontent_item_boxitemlefthere_tow">
{{item.discount || ''}}
</view>
<view class="fivecontent_item_boxitemlefthere_there">
¥{{item.originPrice}}
</view>
</view>
<view class="indexboxitemleftthere_countdown flex-between">
<text class="indexboxitemleftthere_countdowntext">共省{{item.save}}</text>
<view class="indexboxitemleftthere_countdowntexts">
<up-count-down
:time="item.end_times.d * item.end_times.h * item.end_times.m *item.end_times.s"
format="HH:mm:ss" autoStart millisecond @change="onChange">
<view class="time">
<view class="time__custom">
<text
class="time__custom__item">{{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}</text>
</view>
<text class="time__doc">:</text>
<view class="time__custom">
<text
class="time__custom__item">{{ timeData.minutes>10?timeData.minutes:'0'+timeData.minutes }}</text>
</view>
<text class="time__doc">:</text>
<view class="time__custom">
<text
class="time__custom__item">{{ timeData.seconds>10?timeData.seconds:'0'+timeData.seconds }}</text>
</view>
</view>
</up-count-down>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<up-loadmore height='40' :status="formhomelist.status" iconSize='16' fontSize='16' />
</view>
</view>
<indexs v-if="showindex == 'shopIndex'"></indexs>
</view>
@@ -171,14 +161,18 @@
import Nav from '@/components/indexnav.vue'; //导航栏
import {
APIhomehomePageUp,
APIhome,
APIshopUserInfo
APIhome
} from "@/common/api/index/index.js"
import {
APIshopUserInfo
} from "@/common/api/product/product.js"
import {
useNavbarStore
} from '@/stores/navbarStore';
import {
productStore
} from '@/stores/user.js';
const store = useNavbarStore();
// 动态更新导航栏配置
store.updateNavbarConfig({
showBack: true, //左边返回键
rightText: '', //右边文字
@@ -219,12 +213,19 @@
const hometop = async () => {
try {
let res = await APIhomehomePageUp()
Object.assign(hometoplist, res.data)
Object.assign(hometoplist, res)
if (hometoplist.bannervo.counponsInfo) {
hometoplist.bannervo.counponsInfo.forEach((item, index) => {
advertisementStyle.value.push(getStyle(index))
})
}
// 数据加载完后获取dom 高度
setTimeout(() => {
const query = uni.createSelectorQuery().select('#fourcontent');
query.boundingClientRect((rect) => {
elementTop.value = rect.top - store.height
}).exec();
}, 500)
} catch (e) {}
}
// 下面初始数据
@@ -249,7 +250,7 @@
try {
let res = await APIhome(formhomelist)
var dates = new Date().getTime();
res.data.list.forEach((item, index) => {
res.list.forEach((item, index) => {
var leftTime = item.endTime - dates; //计算两日期之间相差的毫秒数
if (leftTime >= 0) {
let d = Math.floor(leftTime / 1000 / 60 / 60 / 24);
@@ -266,9 +267,9 @@
item.end_times = 0
}
})
if (res.data.pages < formhomelist.page) {
if (res.pages < formhomelist.page) {
formhomelist.status = 'nomore'
if (form.page == 1 && res.data.list.length == 0) {
if (form.page == 1 && res.list.length == 0) {
}
return false;
@@ -276,9 +277,9 @@
formhomelist.status = 'loading';
formhomelist.page = ++formhomelist.page;
setTimeout(() => {
homelist.value = [...homelist.value, ...res.data.list];
homelist.value = [...homelist.value, ...res.list];
formhomelist.status = 'loading';
if (res.data.pageNum == res.data.pages) {
if (res.pageNum == res.pages) {
formhomelist.status = 'nomore';
} else {
formhomelist.status = 'loading';
@@ -341,28 +342,21 @@
onShow(() => {})
onMounted(async () => {
await proxy.$onLaunched;
console.log(uni.cache.get('shopId'))
if (uni.cache.get('shopId') && uni.cache.get('token')) {
showindex.value = 'shopIndex'
let res = await APIshopUserInfo({
"shopId": uni.cache.get('shopId'),
"userId": uni.getStorageSync('userInfo').id,
})
if (res.code == 0) {
if (res) {
//商家信息
uni.cache.set('shopUserInfo', res.data)
uni.cache.set('ShopUser', res)
}
} else {
hometop()
init_fn()
showindex.value = 'index'
// 获取初始定位高度
setTimeout(() => {
const query = uni.createSelectorQuery().select('#fourcontent');
query.boundingClientRect((rect) => {
elementTop.value = rect.top - store.height
}).exec();
}, 500)
}
});
@@ -383,16 +377,22 @@
background: #F9F9F9;
.fourcontent {
position: sticky;
padding: 32rpx 0;
overflow-x: auto;
flex-wrap: nowrap;
background: #f9f9f9;
margin: 0 32rpx;
z-index: 99;
left: 0;
.flex-between {
margin: 0 32rpx;
}
.componentsclass {
margin-top: 32rpx;
left: 0;
position: absolute;
position: relative;
width: 100%;
height: 100vh;
transition-duration: 350ms;

View File

@@ -36,17 +36,14 @@
import {
ref,
onMounted,
reactive
reactive,
} from "vue";
import {
onShow,
} from '@dcloudio/uni-app'
import {
APIproductqueryShop
} from "@/common/api/product/product.js";
import {
APIshopExtend
} from "@/common/api/index/index.js";
import {
productStore
} from '@/stores/user.js';
const shopExtend = reactive({
autokey: "index_bg",
@@ -59,34 +56,11 @@
value: ""
})
const userInfo = uni.cache.get('userInfo')
const shopUserInfo = uni.cache.get('shopUserInfo')
const shopUserInfo = uni.cache.get('ShopUser')
const scanCodehandle = (i) => {
uni.pro.navigateTo('product/index', {
tableCode: uni.cache.get('tableCode')
})
// uni.scanCode({
// success: async (res) => {
// let tableCode = getQueryString(decodeURIComponent(res.result), 'code')
// uni.cache.set('tableCode', tableCode)
// if (tableCode) {
// let data = await APIproductqueryShop({
// code: uni.cache.get('tableCode'),
// })
// if (data.data.shopTableInfo && !data.data.shopTableInfo.choseCount) {
// uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
// tableCode: tableCode,
// shopId: data.data.storeInfo.id,
// })
// } else {
// uni.pro.navigateTo('product/product', {
// tableCode: tableCode,
// })
// }
// }
// },
// fail: () => {}
// })
const scanCodehandle = async (i) => {
const store = productStore();
await store.scanCodeactions()
}
const memberindex = (url) => {
uni.pro.navigateTo(url, {
@@ -102,12 +76,12 @@
}
return null;
}
onShow(async () => {
onMounted(async () => {
let res = await APIshopExtend({
shopId: uni.cache.get('shopId'),
autokey: "index_bg" //index_bg my_bg member_bg shopInfo_bg
})
Object.assign(shopExtend, res.data)
Object.assign(shopExtend, res)
})
</script>

View File

@@ -1,6 +1,6 @@
<template>
<view>
<Nav />
<Nav v-if="store.scrollTop>=44" />
<view class="content">
</view>
</view>
@@ -15,7 +15,8 @@
import {
onLoad,
onReady,
onShow
onShow,
onPageScroll
} from '@dcloudio/uni-app'
import Nav from '@/components/CustomNavbar.vue'; //导航栏
// pinia管理
@@ -24,15 +25,23 @@
} from '@/stores/navbarStore';
const store = useNavbarStore();
// 大于44显示导航栏
const navScroll = ref(false)
// 动态更新导航栏配置
store.updateNavbarConfig({
showBack: true, //左边返回键
rightText: '', //右边文字
showSearch: true, //true是标题其他事文字
title: '我的页面',
title: '',
isTransparent: false,
hasPlaceholder: false //是否要占位符
});
//动态导航栏滑动距离
onPageScroll((res) => {
uni.$u.debounce(store.scrollTop = res.scrollTop, 500)
});
</script>
<style lang="scss" scoped>

View File

@@ -94,9 +94,9 @@
type: 'subShop', //团购卷品类Id/subShop-预约到店
orderBy: ''
})
console.log(res.data.carousel[0])
if (res.code == 0) {
toplist.value = res.data.carousel[0]
console.log(res.carousel[0])
if (res) {
toplist.value = res.carousel[0]
// 动态更新导航栏配置
store.updateNavbarConfig({
showBack: true, //左边返回键
@@ -132,21 +132,21 @@
page: form.page, //页数
size: form.size, //页容量
})
if (res.data.pages < form.page) {
if (res.pages < form.page) {
form.status = 'nomore'
if (form.page == 1 && res.data.list.length == 0) {
if (form.page == 1 && res.list.length == 0) {
list.value = []
}
return false;
} else {
form.status = 'loading';
if (form.page == 1) {
list.value = res.data.list
list.value = res.list
} else {
list.value = [...list.value, ...res.data.list];
list.value = [...list.value, ...res.list];
}
form.page = ++form.page;
if (form.page > res.data.pages) {
if (form.page > res.pages) {
form.status = 'nomore';
} else {
form.status = 'loading';

545
pages/order/index.vue Normal file
View File

@@ -0,0 +1,545 @@
<template>
<view>
<view>
<!-- <view class="navtab flex-center">
<view class="navtabpost flex-center">
<view :class="navtabindex == 0 ? 'navtabone':'navtabtow'" @click="navtabclick(0)">
到店订单
</view>
<view :class="navtabindex == 1 ? 'navtabone':'navtabtow'" @click="navtabclick(1)">
团购订单
</view>
</view>
</view> -->
<up-sticky>
<view class="tab-wrap">
<view class="item" :class="{'active':active == index}" v-for="(item, index) in tabs" :key="index"
@click="orderswitch(item,index)">
<text>{{ item.name }}</text>
</view>
</view>
</up-sticky>
<view class="list-wrap" v-if="!is_end">
<view class="item" v-for="(item,index) in orderForm.list" :key="index" @click="orderinfo(item)">
<view class="header-wrap">
<view class="header-wrap-left">
<text class="sendType" v-if="item.sendType == 'post'">快递</text>
<text class="sendType" v-if="item.sendType == 'takeaway'">外卖</text>
<text class="sendType" v-if="item.sendType == 'takeself'">自提</text>
<text class="sendType" v-if="item.sendType == 'table'">堂食</text>
<text class="shopName"> {{ item.shopName || ''}} </text>
</view>
<text class="status" v-if="item.status == 'unpaid' || item.status == 'paying'">
<text style="color: #333;">待付款</text>
</text>
<text class="status" v-if="item.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="item.status == 'closed'">
<text>已完成</text>
</text>
<text class="status" v-if="item.status == 'send'">
<text> 已发</text>
</text>
<text class="status" v-if="item.status == 'refunding'">
<text>申请退单</text>
</text>
<text class="status" v-if="item.status == 'refund'">
<text>退单</text>
</text>
<text class="status" v-if="item.status == 'cancelled'">
<text>已取消</text>
</text>
<text class="status" v-if="item.status == 'merge'">
<text>合台</text>
</text>
</view>
<view class="content">
<view></view>
<view class="intro-wrap">
下单日期{{$u.timeFormat(item.createdAt, 'yyyy-mm-dd hh:MM')}}
</view>
<view class="shop-info">
<view class="shop-item">
<view class="cover" v-for="(item1,index1) in item.detailList" :key="index1">
<u-image width="112" height="112" radius="20" :src='item1.productImg'
v-if="item1.productId!=-999"></u-image>
<u-image width="112" height="112" radius="20"
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
mode="heightFix" v-else></u-image>
<text class="productName"> {{ item1.productName }} </text>
</view>
</view>
<view class="shop-amount">
<text class="orderAmount">{{item.orderAmount}}</text>
<text class="totalNumber">{{item.totalNumber}}</text>
</view>
</view>
</view>
<view class="footer-wrap">
<view class="btn" @click.stop="$u.debounce(isRemoveOrder(item,index),1000)"
v-if="item.status != 'unpaid' && item.status != 'paying'"> 删除订单 </view>
<view class="btn s" @click.stop="$u.debounce(showpopupclick(item),1000)"
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
</view>
</view>
</view>
<!-- 新订单 -->
<!-- <view class="orderList" v-if="navtabindex == 1">
<view class="listBox" v-for="(item,i) in groupList" :key="i" @click="orderinfoTo(item)">
<view class="df">
<view style="display: flex;">
<text>{{item.proName.length>10?item.proName.substring(0,10)+'...':item.proName}}</text><u-icon
name="arrow-right" color="#000" size="28"></u-icon>
</view>
<text
:class="[item.status=='unpaid'||item.status=='unused'?'state':'state2']">{{item.status|statusFirter}}</text>
</view>
<view class="df" style="justify-content: flex-start;margin-top: 32rpx;">
<image style="width:120rpx; height: 120rpx;border-radius: 12rpx 12rpx 12rpx 12rpx;"
:src="item.proImg" mode="aspectFill">
</image>
<view class="ml-20 fontStyle">
<view>数量{{item.number}}</view>
<view>实付<text style="color: #FF4C11;">{{item.payAmount}}</text></view>
</view>
</view>
<button v-if="item.status=='unused'" type="primary" class="buttonStyle">查看券码</button>
<button v-if="item.status=='unpaid'" type="primary" class="buttonStyle">去付款</button>
</view>
</view>
<image style="width: 402rpx;height: 442rpx;margin:240rpx auto 32rpx;"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/nomore.png" v-if="list.length <= 0 "
mode="aspectFill"></image>
<u-modal width="450rpx" :show="removeOrderShow" @confirm="$u.debounce(removeOrder(),1000)"
@cancel="removeOrderShow = false" @close="removeOrderShow = false" :showCancelButton="true"
:closeOnClickOverlay="true" :title="'是否删除当前订单'"></u-modal>-->
<u-loadmore :status="form.status" fontSize="14" color="#999" iconSize="14" />
</view>
</view>
</template>
<script setup>
import {
ref,
reactive,
onMounted
} from "vue";
import {
onLoad,
onReady,
onShow,
onPageScroll
} from '@dcloudio/uni-app'
import Nav from '@/components/CustomNavbar.vue'; //导航栏
import {
APIuserorder
} from '@/common/api/order/index.js'
// pinia管理
import {
useNavbarStore
} from '@/stores/navbarStore';
const store = useNavbarStore();
// 导航栏
const tabs = [{
name: '全部',
type: 1,
status: ''
},
{
name: '待支付',
type: 2,
status: 'unpaid'
},
{
name: '待发货',
type: 3,
status: 'unsend'
},
{
name: '已完成',
type: 4,
status: 'closed'
},
{
name: '退款/售后',
type: 5,
status: 'refund'
},
]
// 初始化是单店还是团购店
const navtabindex = ref('2')
// 总数据列表
const orderForm = reactive({
list: [],
groupList: [],
is_end: [],
status: '',
form: {
page: 1,
size: 10,
status: 'loadmore',
}
})
const form = reactive({
page: 1,
size: 10,
status: 'loadmore',
})
// 团购预留
// const getorderList = async () => {
// await API()
// }
// 单店团购
const userorderList = async () => {
let res = await APIuserorder({
page: orderForm.form.page,
size: orderForm.form.size,
// status: orderForm.status
})
console.log(res)
if (res.totalPage == 1 && res.totalRow <= 10) {
orderForm.form.status = 'nomore'
orderForm.list = res.records
if (orderForm.form.page == 1 && res.records.length == 0) {
orderForm.records = []
orderForm.is_end = true
}
return false;
} else {
orderForm.form.status = 'loading';
orderForm.list = [...orderForm.list, ...res.records];
orderForm.form.page = ++orderForm.form.page;
if (orderForm.form.page > res.totalPage) {
orderForm.form.status = 'nomore';
} else {
orderForm.form.status = 'loading';
}
}
// if (res.totalPage < orderForm.form.page) {
// orderForm.form.status = 'nomore'
// if (orderForm.form.page == 1 && res.records.length == 0) {
// orderForm.records = []
// orderForm.is_end = true
// }
// return false;
// } else {
// orderForm.form.status = 'loading';
// if (orderForm.form.page == 1) {
// orderForm.list = res.list
// } else {
// orderForm.list = [...orderForm.records, ...res.records];
// }
// orderForm.form.page = ++orderForm.form.page;
// if (orderForm.form.page > res.pages) {
// orderForm.form.status = 'nomore';
// } else {
// orderForm.form.status = 'loading';
// }
// }
}
// 初始化
const init_fn = () => {
orderForm.groupList = []
orderForm.is_end = false
orderForm.form.page = 1
orderForm.form.size = 10
orderForm.form.status = 'loadmore'
navtabindex.value == '1' ? getorderList() : userorderList()
}
onShow(() => {
init_fn()
})
// onMounted(() => {})
</script>
<style scoped lang="scss">
page {
// background: #f6f6f6;
}
.navtab {
width: 100%;
height: 56rpx;
background: #ffd158;
.navtabpost {
position: relative;
background: #FFFFFF;
border-radius: 12rpx;
padding: 0 10rpx;
.navtabone {
// margin-left: -10rpx;
width: 166rpx;
height: 36rpx;
background: #FFEAB1;
border-radius: 12rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
color: #333333;
line-height: 36rpx;
text-align: center;
z-index: 10;
}
.navtabtow {
// margin-left: -10rpx;
z-index: 9;
width: 146rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
// border-radius: 0 12rpx 12rpx 0;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
}
.tab-wrap {
display: flex;
position: relative;
background: #fff;
padding: 40rpx 46rpx;
border-radius: 0rpx 0rpx 34rpx 34rpx;
.item {
flex: auto;
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
position: relative;
z-index: 2;
text {
font-weight: 400;
font-size: 28rpx;
color: #999999;
}
}
.item.active {
text {
font-weight: bold;
font-size: 32rpx;
color: #000000;
}
}
}
.list-wrap {
padding: 0 28rpx 48rpx 28rpx;
position: relative;
margin-top: 48rpx;
border-radius: 24rpx 24rpx 0rpx 0rpx;
.item {
border-radius: 20upx;
background-color: #fff;
&:not(:first-child) {
margin-top: 48rpx;
}
.header-wrap {
padding: 16rpx 18rpx;
display: flex;
justify-content: space-between;
align-items: center;
.header-wrap-left {
display: flex;
align-items: center;
}
.sendType {
height: 48rpx;
line-height: 48rpx;
font-weight: 400;
font-size: 24rpx;
color: #E3AD7F;
border-radius: 10rpx 10rpx 10rpx 10rpx;
border: 2rpx solid #E3AD7F;
margin-right: 24rpx;
padding: 0 20rpx;
}
.shopName {
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.status {
text {
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
}
.content {
padding: 0 18rpx 18rpx 18rpx;
.shop-info {
display: flex;
.shop-item {
width: 100%;
display: flex;
overflow: hidden;
overflow-x: scroll;
.cover:nth-child(1) {
margin-left: 0rpx;
}
.cover {
margin-left: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
flex-shrink: 0;
.productName {
flex-shrink: 0;
margin-top: 16rpx;
}
}
}
.shop-amount {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-end;
flex-shrink: 0;
padding-left: 20rpx;
.orderAmount {
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 22rpx;
}
.totalNumber {
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
}
}
.intro-wrap {
font-weight: 400;
color: #666;
font-size: 24upx;
margin-bottom: 16rpx;
}
}
.footer-wrap {
display: flex;
justify-content: flex-end;
padding: 0 18rpx 32rpx 18rpx;
.btn {
width: 128rpx;
height: 48rpx;
line-height: 43rpx;
text-align: center;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
border: 2rpx solid #EDEDED;
font-weight: 400;
font-size: 24rpx;
color: #333333;
margin-left: 32rpx;
}
.s {
background: #343030;
border: 2rpx solid #EDEDED;
color: #fff;
}
}
}
}
.orderList {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
.listBox {
padding: 16rpx 18rpx;
margin-top: 48rpx;
font-size: 32rpx;
width: 694rpx;
height: 248rpx;
background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx;
position: relative;
.buttonStyle {
position: absolute;
right: 20rpx;
bottom: 50rpx;
font-size: 28rpx;
width: 170rpx;
height: 64rpx;
background: #FFD100;
border-radius: 32rpx 32rpx 32rpx 32rpx;
border: none;
color: #000;
}
.state {
color: #FF4C11;
}
.state2 {
color: #999;
}
.fontStyle {
font-size: 28rpx;
font-weight: 400;
color: #666666;
}
}
}
.df {
display: flex;
align-items: center;
justify-content: space-between;
}
.ml-20 {
margin-left: 20rpx;
}
</style>

View File

@@ -0,0 +1,93 @@
<template>
<view>
<!-- 店铺详情 -->
<up-popup :show="showShopInfo" :round="20" mode="bottom" @close="showShopInfo = false" height="500">
<view class="shop-info-wrap">
<view class="info-wrap flex-between">
<view></view>
<text class="shopName">{{ shopInfo.shopName }}</text>
<view class="close" @click="showShopInfo = false">
<up-icon name="close" color="#999999" size="16"></up-icon>
</view>
</view>
<view class="info-wrap-title">商家信息</view>
<view class="row" style="margin-bottom: 20rpx;">
<view class="col">
<text class="l">营业时间</text>
<text
class="t">{{ (shopInfo.businessStartDay || '--') +'至'+ (shopInfo.businessEndDay || '--') +' '+ (shopInfo.businessTime || '')}}</text>
</view>
<view class="col">
<text class="l">商家地址</text>
<text class="t">{{ shopInfo.address }}</text>
</view>
<view class="col" @click="makePhoneCall(shopInfo.phone)">
<text class="l">商家电话</text>
<text class="t">{{ shopInfo.phone }}</text>
</view>
</view>
<view class="info-wrap-title">商家公告</view>
<view class="row">
<view class="col">
<text class="l">公告</text>
<text class="t">{{ shopInfo.detail }}</text>
</view>
</view>
</view>
</up-popup>
</view>
</template>
<script setup>
import {
ref,
defineExpose
} from "vue";
//店铺详情
const showShopInfo = ref(false)
const shopInfo = uni.cache.get('shopInfo')
const childMethod = () => {
showShopInfo.value = !showShopInfo.value
};
defineExpose({
childMethod
});
</script>
<style lang="scss" scoped>
.shop-info-wrap {
padding: 0 30rpx 50rpx;
box-sizing: border-box;
.info-wrap {
padding: 30rpx 0;
box-sizing: border-box;
.shopName {
align-self: center;
font-size: 32rpx;
color: #333;
font-weight: bold;
}
}
.info-wrap-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.row {
.col {
margin-bottom: 10rpx;
}
.l,
.t {
font-size: 24rpx;
color: #999;
}
}
}
</style>

View File

@@ -0,0 +1,146 @@
<template>
<view class="cart-wrap" v-if="cartListsdatashow">
<view class="cart-content">
<view class="left">
<view class="iconBox">
<image class="icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/shopIcon.png"
mode="aspectFill" @click="isOpen">
</image>
<text class="u-badge"> {{cartLists_count<99?cartLists_count:'99+'}} </text>
</view>
<text class="i"></text>
<text class="num"
v-if="shopInfo.isVip == 1 && cartLists.memberAmount > 0">{{cartLists.memberAmount||'0.00'}}</text>
<text class="num" v-else>{{cartLists.amount||'0.00'}}</text>
</view>
<view class="btn" @tap="$u.debounce(orderdetail, 500)">
<text class="t">去结算</text>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
defineProps,
} from 'vue'
const shopInfo = uni.cache.get('shopInfo')
const cartListsdatashow = ref(false)
const showCart = ref(false)
const orderdetail = () => {
if (this.cartLists.data.length == 0) {
uni.showToast({
title: '请先添加商品',
icon: 'none'
})
return false
}
uni.navigateTo({
url: `/pagesOrder/confirm_order/index?storeInfo=${encodeURIComponent(JSON.stringify(this.storeInfo))}&cartLists=${JSON.stringify(this.cartLists)}&tableCode=${this.tableCode||''}`
});
}
const isOpen = () => {
showCart.value = !showCart.value
}
</script>
<style lang="scss">
.cart-wrap {
width: 100%;
padding: 0 20rpx;
box-sizing: border-box;
position: fixed;
bottom: 40rpx;
left: 0;
z-index: 99;
.cart-content {
display: flex;
align-items: center;
height: 128rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 20rpx 2rpx rgba(0, 0, 0, 0.15);
border-radius: 58rpx;
padding: 0 36rpx;
box-sizing: border-box;
.left {
flex: 1;
display: flex;
align-items: center;
position: relative;
.iconBox {
position: relative;
}
.icon {
width: 76rpx;
height: 88rpx;
margin-left: 22rpx;
}
.u-badge {
position: absolute;
top: -30rpx;
right: -30rpx;
background-color: #FF4B33;
color: #fff;
border-radius: 58rpx;
padding: 5rpx 14rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 20rpx;
}
.i,
.num {
color: #333;
}
.i {
font-size: 20upx;
position: relative;
top: 4upx;
margin-left: 64rpx;
}
.num {
font-size: 42upx;
font-weight: bold;
}
}
.btn {
height: 100%;
width: 40%;
display: flex;
align-items: center;
justify-content: flex-end;
.t {
width: 160rpx;
height: 64rpx;
line-height: 64rpx;
text-align: center;
background: #E7AE7B;
border-radius: 36rpx 36rpx 36rpx 36rpx;
border: 2rpx solid #E8AD7B;
font-weight: bold;
font-size: 28rpx;
color: #FFFFFF;
}
}
}
}
</style>

View File

@@ -0,0 +1,397 @@
<template>
<view>
<up-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }"
@close="close">
<view class="cart-list-wrap">
<view class="cart-header flex-between">
<view class="num">已点 {{ cartLists_count }} </view>
<view class="clear" @click="cartclear">
<up-icon name="trash" color="#999"></up-icon>
<text class="t">清空</text>
</view>
</view>
<scroll-view scroll-y class="scroll-view">
<view class="list-wrap">
<view class="shop-item" v-for="(item,index) in props.cartList" :key="item.id">
<view class="shop-item-content">
<view class="cover" v-if="item.productId!=-999">
<up-image :src="item.coverImg" width="120" radius="10" height="120"></up-image>
</view>
<view class="info">
<view class="name"> {{ item.name }} </view>
<view class="select-sku-wrap" v-if="item.skuList">
<text v-for="i in item.skuList" :key="i.id">
{{item.id == i.productId && item.skuId == i.id ? i.specInfo :""}}
</text>
</view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price">
<text class="i"></text>
<!-- 会员价与价格 -->
<text
class="price">{{shopInfo.isVip ==1?item.memberPrice:item.salePrice}}</text>
<!-- <text class="originalprice"
v-if="item.originPrice">¥{{item.originPrice}}</text>
<text class="unit" v-if="item.unitName">/{{item.unitName}}</text> -->
</view>
<view class="operation-wrap">
<view class="btn">
<up-icon name="minus-circle-fill" size="25"></up-icon>
<view class="btnClick" @click="cartListadd(item,'-')"></view>
</view>
<text class="num">{{ ifcartNumber(item) }}</text>
<view class="btn">
<!-- <up-icon name="plus-circle-fill"
:color="shopInfo.isVip == 1 ? '#CECECE' : '#E9AB7A'"
size="25"></up-icon> -->
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
<view class="btnClick" @click="cartListadd(item,'+')"></view>
</view>
</view>
</view>
</view>
</view>
<!-- <view class="shop-item-remark" v-if="item.productId!=-999">
<view class="label">备注</view>
<up--input placeholder="商品备注(选填)" border="none" v-model="item.note"
@blur="productBlur(item)"></up--input>
</view> -->
</view>
</view>
</scroll-view>
</view>
</up-popup>
</view>
</template>
<script setup>
import {
ref,
defineProps,
computed,
defineEmits
} from 'vue';
import {
productStore
} from '@/stores/user.js';
// 定义自定义事件
const emits = defineEmits(['customevent', 'close']);
const props = defineProps({
cartList: {
type: Array
},
cartLists_count: {
type: Number,
default: 0
},
showCart: {
type: Boolean
},
});
const shopInfo = uni.cache.get('shopInfo')
// 定义 ifcartNumber 计算属性方法
const ifcartNumber = computed(() => {
return (item) => {
// 如果 item 为空或者 cartNumber 不是字符串类型,返回 0
if (!item || typeof item.cartNumber !== 'string') {
return 0;
}
let numValue = parseFloat(item.cartNumber);
if (isNaN(numValue)) {
// 如果转换结果是 NaN说明 cartNumber 不是有效的数字字符串,返回 0
return 0;
}
// type string 商品类型 single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
if (item.type === 'weight') {
// 如果类型是称重重量,将值保留两位小数
return parseFloat(numValue.toFixed(2));
} else {
// 如果类型是整数,将值转换为整数
return Math.round(numValue);
}
// 如果类型不匹配,返回原始值
return item.cartNumber;
};
})
const close = () => {
emits("close", false)
}
// 购物车加减
const cartListadd = async (item, i) => {
emits('customevent', {
id: item.cartListId ? item.cartListId : '',
type: 'shopping',
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
operate_type: calculateValue(item.cartNumber, i) == 'del' ? 'del' : item.cartListId &&
item.cartNumber > 0 ? 'edit' : 'add',
product_id: item.id,
sku_id: item.skuId,
number: await calculateValue(item.cartNumber, i),
})
}
// 封装加法函数
const calculateValue = (cartNumber, i, step = 1) => {
if (i == '+') {
const result = parseFloat(cartNumber) + step;
return result.toFixed(2);
} else {
const result = parseFloat(cartNumber) - step;
return result == 0 ? 'del' : result.toFixed(2);
}
};
// 菜品备注修改
const productBlur = (item) => {
let params = {
"skuId": item.skuId,
"num": item.number, //数量
"type": item.type,
"isVip": item.isVip,
"productId": item.productId, //商品id
"note": item.note,
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
"tableId": this.tableCode,
}
this.$emit("addCart", params)
}
// 清空购物车
const cartclear = () => {
emits('customevent', {
type: 'shopping',
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
operate_type: 'cleanup',
})
}
</script>
<style lang="scss">
.cart-list-wrap {
.cart-header {
display: flex;
height: 72rpx;
background-color: #F2F2F2;
align-items: center;
justify-content: space-between;
padding: 20upx 28rpx;
border-radius: 20upx 20upx 0 0;
.num {
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
.clear {
display: flex;
align-items: center;
.t {
font-size: 24upx;
color: #999;
margin-left: 4upx;
}
}
}
.scroll-view {
max-height: 50vh;
margin-bottom: 190rpx;
}
.list-wrap {
padding: 28rpx 0 0 28rpx;
}
.shop-item {
display: flex;
flex-direction: column;
padding-bottom: 28rpx;
.shop-item-content {
display: flex;
}
.shop-item-remark {
display: flex;
align-items: center;
padding-right: 180rpx;
margin-top: 10rpx;
.label {
font-size: 28rpx;
color: #666;
margin-right: 20rpx;
}
}
.langcover {
position: relative;
}
.langcover::after {
content: '加载中..';
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #e8e8e8;
color: #6b6b6b;
border-radius: 10rpx;
text-align: center;
line-height: 180rpx;
z-index: 1;
}
.info {
flex: 1;
padding-left: 20upx;
padding-right: 28rpx;
.name {
font-size: 28upx;
font-weight: bold;
color: #333;
margin-bottom: 5rpx;
}
.select-sku-wrap {
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
.price-wrap {
margin-top: 16rpx;
display: flex;
align-items: center;
justify-content: space-between;
.price {
display: flex;
align-items: flex-end;
.i,
.num {
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.i {
position: relative;
bottom: 4upx;
}
.price {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 36rpx;
color: #333333;
}
.originalprice {
margin-left: 10rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 20rpx;
text-decoration: line-through;
}
.unit {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 36rpx;
color: #333333;
}
.lineThrough {
font-weight: normal;
text-decoration: line-through;
color: #999 !important;
font-size: 24rpx !important;
}
}
.sku-wrap {
padding: 6upx 16upx;
background-color: #ffd100;
border-radius: 12upx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
.t {
font-size: 24upx;
font-weight: bold;
}
.dot {
display: flex;
align-items: center;
justify-content: center;
font-size: 20upx;
position: absolute;
padding: 2upx 12upx;
border-radius: 8upx;
background-color: #eb5232;
color: #fff;
position: absolute;
top: -14upx;
right: -8upx;
}
}
.operation-wrap {
display: flex;
align-items: center;
.num {
font-size: 32upx;
padding: 0 16upx;
}
.btn {
position: relative;
display: flex;
align-items: center;
justify-content: center;
position: relative;
.btnClick {
width: 100rpx;
height: 100rpx;
position: absolute;
// bottom: 0;
}
.btnClick.l {
right: 0;
}
.btnClick.r {
left: 0;
}
}
}
}
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -166,7 +166,7 @@
params.shopId = this.shopId;
}
let res = await this.api.conponList(params)
if (res.code == 0) {
if (res) {
console.log(res)
let list = [];
if (this.type == 'confirm_order_coupon' || this.type == 'orderInfo_coupon') {
@@ -331,7 +331,7 @@
} else {
uni.pro.navigateTo('/pages/order_food/order_food', {
uni.pro.navigateTo('/pages/product/index', {
shopId: item.shopId
})
}

View File

@@ -9,7 +9,7 @@
<image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image>
<view class="name">{{userInfo.nickName || '无'}}</view>
</view>
<image class="my_info_right_qr" @click="clickEvent" v-if="shopInfo.isVip!=0"
<image class="my_info_right_qr" @click="clickEvent" v-if="userInfo.isVip!=0"
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_qRcode.png'" mode="aspectFill">
</image>
<view class="my_info_right" @click="clickEvent" v-else>
@@ -21,11 +21,26 @@
<view class="my_item my_assets">
<view class="my_item_title">我的资产</view>
<view class="my_assets_list">
<view class="my_list_item" @click="clickTo(item,index)" v-for="(item,index) in myAssetsList"
:key="index">
<image class="my_list_item_icon" :src="item.icon" mode="aspectFill"></image>
<view class="my_list_item_name">{{item.name}}</view>
<view class="my_list_item_num">{{item.num || '**'}}</view>
<view class="my_list_item">
<image class="my_list_item_icon"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/storedValue.png" mode="aspectFill">
</image>
<view class="my_list_item_name">储值</view>
<view class="my_list_item_num">{{userInfo.assetsSummary.amount || '0'}}</view>
</view>
<view class="my_list_item">
<image class="my_list_item_icon"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png">
</image>
<view class="my_list_item_name">积分</view>
<view class="my_list_item_num">{{userInfo.assetsSummary.couponNum ||'0'}}</view>
</view>
<view class="my_list_item">
<image class="my_list_item_icon"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/coupon.png">
</image>
<view class="my_list_item_name">优惠券</view>
<view class="my_list_item_num">{{userInfo.assetsSummary.points ||'0'}}</view>
</view>
</view>
</view>
@@ -33,8 +48,8 @@
<view class="my_item my_fun">
<view class="my_item_title">我的功能</view>
<view class="my_fun_list">
<view class="my_list_item" @click="clickTo(item,index)" v-for="(item,index) in myFunList"
:key="index">
<view class="my_list_item" v-for="(item,index) in myFunList" :key="index"
@click="clickTo(item,index)">
<view class="my_list_item_left">
<image class="my_list_item_icon" :src="item.icon" mode="aspectFill"></image>
<view class="my_list_item_name">{{item.name}}</view>
@@ -63,28 +78,10 @@
onReady,
onShow
} from '@dcloudio/uni-app'
const myAssetsList = ref([
[{
name: "储值",
type: "recharge",
num: 0,
icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/storedValue.png"
},
{
name: "积分",
type: "points",
num: 0,
icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png"
},
{
name: "优惠券",
type: "my_coupon",
num: 0,
icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/coupon.png"
},
// { name: "权益卡", type: "", num: 0, icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/equityCard.png"}
]
])
import {
productStore
} from '@/stores/user.js';
const store = productStore();
const myFunList = ref([{
name: "我的优惠券",
type: "my_coupon",
@@ -108,15 +105,40 @@
},
// { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"},
])
const shopInfo = reactive({
isVip: 0
})
const userInfo = reactive({
nickName: '无名',
headImg: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_member.png'
})
const teblist = ref([])
const shopExtend = ref(null)
const userInfo = ref({
headImg: '',
nickName: '',
isVip: '',
assetsSummary: {
amount: 0,
couponNum: 0,
points: 2
}
})
const clickEvent = () => {
if (uni.cache.get('shopId') && uni.cache.get('token')) {
if (this.userInfo.isVip == 0) {
uni.pro.navigateTo('member/memberdetails', {
shopId: uni.cache.get('shopId')
})
} else {
uni.navigateTo({
url: '/pages/pay_code/pay_code?userInfo=' + JSON.stringify(this.userInfo)
})
}
} else {
uni.pro.navigateTo('member/list', {
type: 'user_payCode'
})
}
}
onShow(async () => {
await store.actionsAPIuser()
userInfo.value = uni.cache.get('userInfo')
console.log(userInfo.value, 11)
})
</script>
<style scoped lang="scss">