This commit is contained in:
parent
a55a75b088
commit
0285780294
|
@ -17,5 +17,10 @@ export const cartDeleteApi = (data)=>{
|
|||
|
||||
//购物车-零售列表
|
||||
export const cartListApi = (data)=>{
|
||||
return request.get('/order/RetailOrder/checkOrder', data);
|
||||
return request.get('/order/cart/list', data);
|
||||
}
|
||||
|
||||
//购物车-零售购物车预检
|
||||
export const checkOrderApi = (data)=>{
|
||||
return request.post('/order/RetailOrder/checkOrder', data);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
import request from '@/utils/request';
|
||||
|
||||
//提交零售订单
|
||||
export const createOrderApi = (data)=>{
|
||||
return request.post('/order/RetailOrder/createOrder', data);
|
||||
}
|
|
@ -10,14 +10,14 @@
|
|||
</view>
|
||||
</view>
|
||||
<scroll-view style="height: 600rpx;padding-bottom: 20rpx;" scroll-y>
|
||||
<view class="row" v-for="(item,index) in 10" :key="index" @click="addressType=index">
|
||||
<view class="row" v-for="(item,index) in list" :key="index" @click="addressType=index">
|
||||
<view class="content">
|
||||
<view class="top">
|
||||
<view class="name">小李</view>
|
||||
<view class="phone">151****9999</view>
|
||||
<u-tag style="pointer-events: none;" text="默认" type="success" plain size="mini"></u-tag>
|
||||
<view class="name">{{item.real_name}}</view>
|
||||
<view class="phone">{{item.phone}}</view>
|
||||
<u-tag v-if="item.is_default" style="pointer-events: none;" text="默认" type="success" plain size="mini"></u-tag>
|
||||
</view>
|
||||
<view class="bottom u-line-2">四川泸州市龙马潭区莲花池街道商业街1号</view>
|
||||
<view class="bottom u-line-2">{{item.detail}}</view>
|
||||
</view>
|
||||
<image v-if="addressType==index" src="@/static/icon/check.png"></image>
|
||||
<image v-else src="@/static/icon/n-check.png"></image>
|
||||
|
@ -37,6 +37,10 @@
|
|||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default: ()=>[]
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -46,7 +50,7 @@
|
|||
}
|
||||
|
||||
const submitAddress = () => {
|
||||
emit('change', addressType.value);
|
||||
emit('change', props.list[addressType.value]);
|
||||
}
|
||||
|
||||
const navTo = (url)=>{
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
<template>
|
||||
<up-popup :show="show" closeable round="10" @close="close">
|
||||
<view class="good-popup">
|
||||
<view class="head-title">称重商品</view>
|
||||
<view class="row">
|
||||
<view>商品名称</view>
|
||||
<view>{{datas.name || datas.goods_name}}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view>商品单位</view>
|
||||
<view>{{datas.unit_name}}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view>商品价格</view>
|
||||
<view>¥ {{datas.sell}}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view>小计</view>
|
||||
<view style="color: #F55726;">¥ {{subtotal}}</view>
|
||||
</view>
|
||||
<view v-if="datas.is_bulk" class="row">
|
||||
<view>商品重量<text style="color: #F55726;">*</text></view>
|
||||
<view><up-input v-model="datas.cart_num" border="none" placeholder="请输入重量" inputAlign="right"></up-input></view>
|
||||
</view>
|
||||
<view v-else class="row">
|
||||
<view>商品数量<text style="color: #F55726;">*</text></view>
|
||||
<view><up-input v-model="datas.cart_num" border="none" placeholder="请输入数量" inputAlign="right"></up-input></view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view style="width: 30%;margin-right: 30rpx;">
|
||||
<up-button @click="close" color="#f7f7f7"><text style="color: #333;">取消</text></up-button>
|
||||
</view>
|
||||
<view style="flex: 1;">
|
||||
<up-button @click="change" color="#20b128">确定</up-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from "vue"
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
})
|
||||
|
||||
const datas = ref({
|
||||
cart_num: ''
|
||||
});
|
||||
const setData = (e)=>{
|
||||
datas.value = e;
|
||||
}
|
||||
|
||||
const emit = defineEmits(['close', 'change']);
|
||||
const close = () => {
|
||||
emit('close');
|
||||
}
|
||||
|
||||
const change = () => {
|
||||
emit('change', datas.value);
|
||||
}
|
||||
|
||||
const subtotal = computed(()=>{
|
||||
let num = +datas.value.cart_num || 0;
|
||||
let sell = +datas.value.sell;
|
||||
return Math.ceil(num * sell * 100) / 100
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
setData
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.good-popup {
|
||||
padding: 30rpx;
|
||||
|
||||
.head-title {
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 20rpx;
|
||||
border-bottom: 1rpx solid #f6f6f6;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
.top {
|
||||
display: flex;
|
||||
|
||||
view {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {}
|
||||
}
|
||||
|
||||
image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes disappear {
|
||||
to {
|
||||
opacity: 0;
|
||||
/* 渐隐 */
|
||||
transform: scale(0);
|
||||
/* 缩小 */
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,11 +1,11 @@
|
|||
let BASE_URL
|
||||
import store from "@/store/user.js"
|
||||
// 环境
|
||||
let env = "dev"
|
||||
// let env = "prod"
|
||||
// let env = "dev"
|
||||
let env = "prod"
|
||||
|
||||
switch(env){
|
||||
case 'prod': BASE_URL = '';break;
|
||||
case 'prod': BASE_URL = 'https://ceshi-erp.lihaink.cn';break;
|
||||
default: BASE_URL = 'http://192.168.1.21:8787';
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<view>
|
||||
<up-navbar placeholder>
|
||||
<template #left>
|
||||
<view style="display: flex;">
|
||||
<up-navbar placeholder :autoBack="true">
|
||||
<template #center>
|
||||
<view style="display: flex;align-items: center;width: 100%;justify-content: flex-start;margin-left: 100rpx;">
|
||||
<view class="tabs" :class="{'tabs-active': tabsActive==index}" v-for="(item, index) in list" :key="index"
|
||||
@click="changeTab(index)">
|
||||
{{item}}
|
||||
|
@ -16,27 +16,26 @@
|
|||
<scroll-view scroll-y style="height: 100%;width: 100%;">
|
||||
<view class="page-box1">
|
||||
<view class="total">
|
||||
<view>共计<text style="color: #20B128;">3</text>件</view>
|
||||
<view>共计<text style="color: #20B128;">{{cartList.length}}</text>件</view>
|
||||
<view v-if="true">管理</view>
|
||||
<view v-else>完成</view>
|
||||
</view>
|
||||
<view v-if="true" class="list" style="margin-top: 80rpx;">
|
||||
<view class="shop-item" v-for="(item, index) in 20" :key="index">
|
||||
<view class="shop-item" v-for="(item, index) in cartList" :key="index" @click="openGoodPopup(item)">
|
||||
<view class="shop-check">
|
||||
<image v-if="index%3==0" src="@/static/icon/n-check.png"></image>
|
||||
<image v-if="!item.check" src="@/static/icon/n-check.png"></image>
|
||||
<image v-else src="@/static/icon/check.png"></image>
|
||||
</view>
|
||||
<image class="shop-img" src="https://cdn.uviewui.com/uview/album/1.jpg"></image>
|
||||
<image class="shop-img" :src="item.imgs"></image>
|
||||
<view class="shop-content">
|
||||
<view class="title">
|
||||
<view class="name u-line-2">好吃的瓜果</view>
|
||||
<view class="tip u-line-1">香味辛辣|葱香味浓|调味增香香味辛辣|葱香味浓|调味增香</view>
|
||||
<view class="name u-line-2">{{item.goods_name}}</view>
|
||||
<view class="tip u-line-1">{{item.unit_name}}</view>
|
||||
</view>
|
||||
<view class="price-btn">
|
||||
<view class="price">¥12.00</view>
|
||||
<view class="price">¥{{item.goods_total_price}}</view>
|
||||
<view class="btn">
|
||||
<u--icon name="minus-circle-fill" size="20" color="#20b128"></u--icon>
|
||||
<view class="num">{{1}}</view>
|
||||
<view class="num">{{item.cart_num}}</view>
|
||||
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -95,8 +94,8 @@
|
|||
<view style="width: 80rpx;">合计:</view>
|
||||
<view class="price">
|
||||
<text style="font-size: 24rpx;">¥</text>
|
||||
<text style="font-size: 34rpx;">20</text>
|
||||
<text style="font-size: 24rpx;">.30</text>
|
||||
<text style="font-size: 34rpx;">{{c_price(cartInfo.total_price, 0)}}</text>
|
||||
<text style="font-size: 24rpx;">.{{c_price(cartInfo.total_price, 1)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<up-button color="#20b128" shape="circle" :disabled="false" @click="settleAccounts">去结算<text>(2)</text></up-button>
|
||||
|
@ -107,12 +106,15 @@
|
|||
</view>
|
||||
</view>
|
||||
</up-transition>
|
||||
<goodPopup ref="goodRef" :show="showGoodPopup" @close="showGoodPopup=false" @change="changeGood" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onShow } from "@dcloudio/uni-app"
|
||||
import { ref } from 'vue';
|
||||
import { cartListApi } from "@/api/cart.js"
|
||||
import { cartListApi, cartChangeApi } from "@/api/cart.js"
|
||||
import goodPopup from "@/components/goodPopup.vue"
|
||||
|
||||
// 创建响应式数据
|
||||
const list = ref(['购物车', '常买']);
|
||||
|
@ -136,13 +138,61 @@
|
|||
})
|
||||
}
|
||||
|
||||
const cartList = ref([]);
|
||||
const getcartList = ()=>{
|
||||
cartListApi().then(res=>{
|
||||
console.log(res);
|
||||
const addCart = (id, cart_num) => { //加入购物车
|
||||
cartChangeApi({
|
||||
cart_num: cart_num,
|
||||
is_new: 0, // 是否直接购买0否1是
|
||||
cart_id: id
|
||||
}).then(res => {
|
||||
getcartList();
|
||||
})
|
||||
}
|
||||
getcartList()
|
||||
const removeCart = (id) => {
|
||||
let num = cartList.get(id) || 0;
|
||||
if (num == 0) return;
|
||||
cartChangeApi({
|
||||
cart_id: id,
|
||||
cart_num: num--
|
||||
}).then(res => {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
// 选择商品相关
|
||||
const showGoodPopup = ref(false);
|
||||
const goodRef = ref(null);
|
||||
const goodData = ref({});
|
||||
const openGoodPopup = (item) => { // 打开数量/重量弹窗
|
||||
goodData.value = item;
|
||||
goodRef.value.setData(item);
|
||||
showGoodPopup.value = true;
|
||||
};
|
||||
const changeGood = (data)=>{ // 确定选择商品重量
|
||||
showGoodPopup.value = false;
|
||||
addCart(data.cart_id, data.cart_num);
|
||||
}
|
||||
|
||||
const cartList = ref([]);
|
||||
const cartInfo = ref({});
|
||||
const getcartList = ()=>{
|
||||
cartListApi().then(res=>{
|
||||
res.data.lists = res.data.lists.map(item=>{
|
||||
item.check = true;
|
||||
return item;
|
||||
})
|
||||
cartList.value = res.data.lists;
|
||||
cartInfo.value = res.data?.extend?.total_price || '0.00';
|
||||
})
|
||||
}
|
||||
|
||||
const c_price = (price=0, index=0)=>{
|
||||
price = price + '';
|
||||
return price.split('.')[index] || 0;
|
||||
}
|
||||
|
||||
onShow(()=>{
|
||||
getcartList();
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<view class="content">
|
||||
<up-navbar placeholder style="z-index: 10080;">
|
||||
<template #left>
|
||||
<view style="font-size: 30rpx;font-weight: bold;">里海商户采购平台</view>
|
||||
<view style="font-size: 30rpx;font-weight: bold;">惠农批发</view>
|
||||
</template>
|
||||
</up-navbar>
|
||||
<view class="navbar">
|
||||
|
@ -21,7 +21,7 @@
|
|||
<view style="position: relative;overflow: hidden;">
|
||||
<scroll-view class="head-view" scroll-x>
|
||||
<view class="list">
|
||||
<view class="item" :class="{'item-active': topActive==item.id}" v-for="(item, index) in goodClassList"
|
||||
<view class="item" :class="{'item-active': topActive===item.id}" v-for="(item, index) in goodClassList"
|
||||
:key="index" @click="changeOne(item, index)">
|
||||
<view class="c-img"><up-image height="100rpx" width="100rpx" :src="item.pic"></up-image></view>
|
||||
<view class="c-text u-line-1">{{item.name}}</view>
|
||||
|
@ -41,7 +41,7 @@
|
|||
<view class="head-title">全部分类</view>
|
||||
<scroll-view scroll-y style="height: 600rpx;">
|
||||
<view class="list">
|
||||
<view class="item" :class="{'item-active': topActive==item.id}" v-for="(item, index) in goodClassList"
|
||||
<view class="item" :class="{'item-active': topActive===item.id}" v-for="(item, index) in goodClassList"
|
||||
:key="index" @click="changeOne(item, index)">
|
||||
<view class="c-img"><up-image height="100rpx" width="100rpx" :src="item.pic"></up-image></view>
|
||||
<view class="c-text u-line-1">{{item.name}}</view>
|
||||
|
@ -52,7 +52,7 @@
|
|||
</viewPopup>
|
||||
<view class="scroll-box">
|
||||
<scroll-view class="left" scroll-y>
|
||||
<view class="item u-line-1" :class="{'item-active': leftActive==item.id}" v-for="(item, index) in goodClassTow"
|
||||
<view class="item u-line-1" :class="{'item-active': leftActive===item.id}" v-for="(item, index) in goodClassTow"
|
||||
:key="index" @click="changeTwo(item, index)">{{item.name}}</view>
|
||||
<view style="width: 100%;height: 300rpx;"></view>
|
||||
</scroll-view>
|
||||
|
@ -60,7 +60,7 @@
|
|||
<view class="classify">
|
||||
<scroll-view style="height: 90rpx;" scroll-x>
|
||||
<view class="classify-list">
|
||||
<view class="classify-list-item u-line-1" :class="{'item-active': rightActive==item.id}"
|
||||
<view class="classify-list-item u-line-1" :class="{'item-active': rightActive===item.id}"
|
||||
v-for="(item, index) in goodClassThree" :key="index" @click="changeThree(item, index)">
|
||||
{{item.name}}
|
||||
</view>
|
||||
|
@ -81,7 +81,7 @@
|
|||
<view class="cateOne">
|
||||
<scroll-view scroll-y style="height: 230rpx;">
|
||||
<view class="classify-list">
|
||||
<view class="classify-list-item u-line-1" :class="{'item-active': rightActive==item.id}"
|
||||
<view class="classify-list-item u-line-1" :class="{'item-active': rightActive===item.id}"
|
||||
v-for="(item, index) in goodClassThree" :key="index" @click="changeThree(item, index)">
|
||||
{{item.name}}
|
||||
</view>
|
||||
|
@ -90,7 +90,7 @@
|
|||
</view>
|
||||
</viewPopup>
|
||||
<scroll-view class="list" scroll-y @scrolltolower="loadMoreGood">
|
||||
<view class="shop-item" v-for="(item, index) in goodList" :key="item.id">
|
||||
<view class="shop-item" v-for="(item, index) in goodList" :key="item.id" @click="openGoodPopup(item)">
|
||||
<view class="shop-img">
|
||||
<up-image width="160rpx" height="160rpx" :src="item.imgs"></up-image>
|
||||
</view>
|
||||
|
@ -106,12 +106,7 @@
|
|||
<view class="price-btn">
|
||||
<view class="price">¥{{item.sell}}</view>
|
||||
<view class="btn">
|
||||
<up-transition :show="cartList.get(item.id)>0"><u--icon name="minus-circle-fill" size="20"
|
||||
color="#20b128" @click="removeCart(item.id)"></u--icon></up-transition>
|
||||
<up-transition :show="cartList.get(item.id)>0">
|
||||
<view class="num">{{cartList.get(item.id)}}</view>
|
||||
</up-transition>
|
||||
<u--icon name="plus-circle-fill" size="20" color="#20b128" @click="addCart(item.id)"></u--icon>
|
||||
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -124,30 +119,36 @@
|
|||
<view class="price-info">
|
||||
<view class="row">
|
||||
<view>合计</view>
|
||||
<view class="price">¥<text style="font-size: 36rpx;">50.00</text></view>
|
||||
<view class="price">¥<text style="font-size: 36rpx;">{{cartInfo.total_price}}</text></view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view>原价 ¥50.00</view>
|
||||
<!-- <view class="row">
|
||||
<view style="color: #777;">原价 ¥50.00</view>
|
||||
<view class="price">优惠 ¥0.00</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="btn">
|
||||
<up-button color="#20b128">结算</up-button>
|
||||
<up-button color="#20b128" :disabled="cartInfo.count==0" @click="settleAccounts">结算</up-button>
|
||||
</view>
|
||||
<view class="cart">
|
||||
<view class="cart" @click="navTo('/pages/cart/cart')">
|
||||
<image src="@/static/icon/cart.png"></image>
|
||||
<view class="badge">{{cartInfo.count}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<goodPopup ref="goodRef" :show="showGoodPopup" @close="showGoodPopup=false" @change="changeGood" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { reactive, ref } from "vue"
|
||||
import { goodListApi, goodClassListApi } from "@/api/good.js"
|
||||
import { cartCreateApi, cartChangeApi } from "@/api/cart.js"
|
||||
import { cartCreateApi, cartChangeApi, cartListApi } from "@/api/cart.js"
|
||||
import viewPopup from "@/components/viewPopup.vue"
|
||||
import goodPopup from "@/components/goodPopup.vue"
|
||||
import useCartStore from "@/store/cart.js"
|
||||
|
||||
const cartStore = useCartStore();
|
||||
|
||||
const show = ref(0);
|
||||
|
||||
|
@ -158,8 +159,9 @@
|
|||
show.value = 0;
|
||||
goodClassTow.value = item?.children || [];
|
||||
goodClassThree.value = goodClassTow.value[0]?.children || [];
|
||||
leftActive.value = goodClassTow.value[0]?.id;
|
||||
rightActive.value = goodClassThree.value[0]?.id;
|
||||
leftActive.value = goodClassTow.value[0]?.id || '';
|
||||
rightActive.value = goodClassThree.value[0]?.id || '';
|
||||
getGoodList();
|
||||
}
|
||||
|
||||
const leftActive = ref(0);
|
||||
|
@ -168,7 +170,8 @@
|
|||
leftActive.value = item.id;
|
||||
show.value = 0;
|
||||
goodClassThree.value = item?.children || [];
|
||||
rightActive.value = goodClassThree.value[0]?.id;
|
||||
rightActive.value = goodClassThree.value[0]?.id || '';
|
||||
getGoodList();
|
||||
}
|
||||
|
||||
const rightActive = ref(0);
|
||||
|
@ -176,18 +179,20 @@
|
|||
console.log('选择', item, index);
|
||||
rightActive.value = item.id;
|
||||
show.value = 0;
|
||||
getGoodList();
|
||||
}
|
||||
|
||||
const cartList = reactive(new Map());
|
||||
const addCart = (id) => { //加入购物车
|
||||
const addCart = (id, cart_num) => { //加入购物车
|
||||
cartCreateApi({
|
||||
cart_num: 1,
|
||||
cart_num: cart_num,
|
||||
is_new: 0, // 是否直接购买0否1是
|
||||
goods_id: id
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
let now = cartList.get(id) || 0;
|
||||
cartList.set(id, now + 1);
|
||||
getCartList();
|
||||
})
|
||||
}
|
||||
const removeCart = (id) => {
|
||||
|
@ -205,8 +210,8 @@
|
|||
const keyword = ref('');
|
||||
|
||||
const searchKeyword = () => {
|
||||
console.log('搜索', keyword.value);
|
||||
where.value = keyword.value;
|
||||
where.value.name = keyword.value;
|
||||
getGoodList();
|
||||
}
|
||||
|
||||
const changeOrder = (order) => {
|
||||
|
@ -215,17 +220,29 @@
|
|||
}
|
||||
|
||||
const where = ref({
|
||||
page: 1,
|
||||
pageSize: 25,
|
||||
keyword: '',
|
||||
page_no: 1,
|
||||
page_size: 25,
|
||||
name: '',
|
||||
order: ''
|
||||
})
|
||||
const loading = ref(true);
|
||||
const goodList = ref([]);
|
||||
const getGoodList = () => {
|
||||
const getGoodList = (loadmore = false) => {
|
||||
loading.value = true;
|
||||
goodListApi(where.value).then(res => {
|
||||
goodList.value = [...goodList.value, ...res.data.lists];
|
||||
let class_id = rightActive.value || leftActive.value || topActive.value || '';
|
||||
let class_all = '';
|
||||
// 若分类没有选中时,则直接查询上一级分类
|
||||
if(rightActive.value=='') class_all = leftActive.value;
|
||||
if(leftActive.value=='') class_all = topActive.value;
|
||||
if(topActive.value=='') class_all = '';
|
||||
if(class_all) class_id = ""; //只能带其中一个
|
||||
goodListApi({
|
||||
...where.value,
|
||||
class_all: class_all,
|
||||
class: class_id
|
||||
}).then(res => {
|
||||
if (loadmore) goodList.value.push(...res.data.lists);
|
||||
else goodList.value = res.data.lists;
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -239,6 +256,30 @@
|
|||
const goodClassThree = ref([]); // 三级分类
|
||||
const getgoodClassList = () => {
|
||||
goodClassListApi().then(res => {
|
||||
res.data?.lists?.unshift({
|
||||
id: "",
|
||||
name: "全部",
|
||||
pic: "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png",
|
||||
children: []
|
||||
})
|
||||
res.data.lists = res.data.lists.map(item=>{
|
||||
if(!item.children) item.children = [];
|
||||
item.children?.unshift({
|
||||
id: "",
|
||||
pid: item.id,
|
||||
name: "全部",
|
||||
})
|
||||
item.children = item.children.map(t=>{
|
||||
if(!t.children) t.children = [];
|
||||
t.children?.unshift({
|
||||
id: "",
|
||||
pid: t.id,
|
||||
name: "全部",
|
||||
})
|
||||
return t;
|
||||
})
|
||||
return item;
|
||||
})
|
||||
goodClassList.value = res.data?.lists || [];
|
||||
goodClassTow.value = goodClassList.value[0]?.children || [];
|
||||
goodClassThree.value = goodClassTow.value[0]?.children || [];
|
||||
|
@ -254,10 +295,51 @@
|
|||
})
|
||||
}
|
||||
|
||||
// 选择商品相关
|
||||
const showGoodPopup = ref(false);
|
||||
const goodRef = ref(null);
|
||||
const goodData = ref({});
|
||||
const openGoodPopup = (item) => { // 打开数量/重量弹窗
|
||||
goodData.value = item;
|
||||
goodRef.value.setData(item);
|
||||
showGoodPopup.value = true;
|
||||
};
|
||||
const changeGood = (data)=>{ // 确定选择商品重量
|
||||
showGoodPopup.value = false;
|
||||
addCart(data.id, data.cart_num);
|
||||
}
|
||||
// 结算
|
||||
const settleAccounts = ()=>{
|
||||
uni.navigateTo({
|
||||
url: '/pagesOrder/settle/settle'
|
||||
})
|
||||
}
|
||||
|
||||
// 购物车相关
|
||||
const cartInfo = ref({
|
||||
total_price: '0.00',
|
||||
count: 0
|
||||
})
|
||||
const getCartList = (res)=>{
|
||||
cartListApi({
|
||||
page_no: 1,
|
||||
page_size: 100,
|
||||
}).then(res=>{
|
||||
cartInfo.value = {
|
||||
total_price: res.data?.extend?.total_price || '0.00',
|
||||
count: res.data?.count || 0
|
||||
}
|
||||
cartStore.setCartList(res.data?.lists.map(item=>item.cart_id))
|
||||
})
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
getgoodClassList();
|
||||
getGoodList();
|
||||
})
|
||||
onShow(()=>{
|
||||
getCartList();
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -645,6 +727,20 @@
|
|||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
}
|
||||
|
||||
.badge {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
background-color: #F55726;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
text-align: center;
|
||||
line-height: 26rpx;
|
||||
font-size: 18rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -10,7 +10,7 @@
|
|||
</up-navbar>
|
||||
<view class="login-box">
|
||||
<image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png"></image>
|
||||
<view class="tips">欢迎登录里海商户采购平台</view>
|
||||
<view class="tips">欢迎登录惠农批发</view>
|
||||
<block v-if="showWeixin">
|
||||
<up-transition :show="showWeixin">
|
||||
<view class="btn">
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<view class="card">
|
||||
<view class="is-default">
|
||||
<view>设置为默认地址</view>
|
||||
<up-switch v-model="formData.isDefault" activeColor="#20B128"></up-switch>
|
||||
<up-switch v-model="formData.is_default" :activeValue="1" :inactiveValue="0" activeColor="#20B128"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom-fixed">
|
||||
|
@ -37,7 +37,7 @@
|
|||
real_name: '',
|
||||
phone: '',
|
||||
detail: '',
|
||||
isDefault: false
|
||||
is_default: 0
|
||||
})
|
||||
const rules = ref({
|
||||
real_name: [{ required: true, message: '请输入姓名', trigger: ['blur'] }],
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<view class="left">
|
||||
<image v-if="false" src="@/static/icon/check.png"></image>
|
||||
<view class="left" @click="updateDefault(item)">
|
||||
<image v-if="item.is_default" src="@/static/icon/check.png"></image>
|
||||
<image v-else src="@/static/icon/n-check.png"></image>
|
||||
<view>设为默认</view>
|
||||
</view>
|
||||
|
@ -39,7 +39,7 @@
|
|||
<script setup>
|
||||
import { ref } from "vue"
|
||||
import modal from "@/components/modal.vue";
|
||||
import { addressListsApi } from "@/api/user.js";
|
||||
import { addressListsApi, addressEditApi, addressDeleteApi } from "@/api/user.js";
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
|
||||
const navTo = (url)=>{
|
||||
|
@ -55,10 +55,18 @@ const showDelete = (item)=>{
|
|||
show.value = true;
|
||||
}
|
||||
|
||||
const deleteAddress = ()=>{
|
||||
console.log(deleteInfo.value);
|
||||
show.value = false;
|
||||
const updateDefault = (item)=>{
|
||||
addressEditApi({
|
||||
...item,
|
||||
is_default: !item.is_default
|
||||
})
|
||||
}
|
||||
|
||||
const deleteAddress = ()=>{
|
||||
addressDeleteApi({
|
||||
address_id: deleteInfo.value.address_id
|
||||
})
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
const addressList = ref([]);
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
<template>
|
||||
<view class="">
|
||||
<view class="m-card row">
|
||||
<up-cell-group>
|
||||
<up-cell title="请添加自提点" :isLink="true" :border="false"></up-cell>
|
||||
</up-cell-group>
|
||||
</view>
|
||||
<view v-if="!isAddress" class="m-card row">
|
||||
<up-cell-group>
|
||||
<up-cell title="我的地址" :isLink="true" :border="false" @click="showAddress=true"></up-cell>
|
||||
|
@ -9,11 +14,11 @@
|
|||
<view class="address-info">
|
||||
<view class="top">
|
||||
<up-icon name="map"></up-icon>
|
||||
<view class="t-name">小王</view>
|
||||
<view>155****9999</view>
|
||||
<view class="t-name">{{addressInfo.real_name}}</view>
|
||||
<view>{{addressInfo.phone}}</view>
|
||||
</view>
|
||||
<view class="bottom u-line-2">
|
||||
四川泸州市龙马潭区莲花池街道商业街1号
|
||||
{{addressInfo.detail}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="address-btn">
|
||||
|
@ -21,34 +26,31 @@
|
|||
:customStyle="{color:'#666666'}">修改</up-button></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-card row">
|
||||
<up-cell-group>
|
||||
<up-cell title="请添加自提点" :isLink="true" :border="false"></up-cell>
|
||||
</up-cell-group>
|
||||
<view class="m-card m-good" v-for="(item,index) in cartList" :key="index">
|
||||
<view class="image" >
|
||||
<up-image width="160rpx" height="160rpx" :src="item.imgs"></up-image>
|
||||
</view>
|
||||
<view class="m-card m-good">
|
||||
<image class="image" src="../../static/logo.png"></image>
|
||||
<view class="body-content">
|
||||
<view>
|
||||
<view class="title">
|
||||
<view>黄牛肉20kg</view>
|
||||
<view>¥10.00</view>
|
||||
<view>{{item.name}}</view>
|
||||
<view>¥{{item.price}}</view>
|
||||
</view>
|
||||
<view class="tips">
|
||||
<view>我不吃牛肉</view>
|
||||
<view>x5</view>
|
||||
<view>{{item.unit_name}}</view>
|
||||
<view>x{{item.cart_num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="time">
|
||||
预计48小时发货
|
||||
{{orderInfo.delivery_msg}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-card good-info">
|
||||
<view class="head-title">价格明细</view>
|
||||
<view class="row">
|
||||
<view>商品总价 <text>共计5件商品</text></view>
|
||||
<view><text>¥</text>50<text>.00</text></view>
|
||||
<view>商品总价 <text>共计{{cartList.length}}款商品</text></view>
|
||||
<view><text>¥</text>{{c_price(orderInfo.total, 0)}}<text>.{{c_price(orderInfo.total, 1)}}</text></view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view>运费</view>
|
||||
|
@ -66,22 +68,23 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-card order-remark">
|
||||
<!-- <view class="m-card order-remark">
|
||||
<view class="head-title">
|
||||
<text>订单备注</text>
|
||||
<text>0/200</text>
|
||||
</view>
|
||||
<up-textarea style="background-color: #F6F6F6;" v-model="formData.remark" placeholder="暂无备注内容"
|
||||
:height="100"></up-textarea>
|
||||
</view>
|
||||
</view> -->
|
||||
<view style="width: 100%;height: 200rpx;"></view>
|
||||
<view class="fiexd-btn-box">
|
||||
<view class="tips">
|
||||
<view style="margin-right: 20rpx;">80款,共500件</view>
|
||||
<view style="margin-right: 20rpx;">共 {{ cartList.length }} 款</view>
|
||||
<view class="all">
|
||||
<text style="color: #000;">合计: </text>
|
||||
<text>¥</text>
|
||||
<text style="font-size: 32rpx;font-weight: bold;">5620</text>
|
||||
<text>.26</text>
|
||||
<text style="font-size: 32rpx;font-weight: bold;">{{c_price(orderInfo.total, 0)}}</text>
|
||||
<text>.{{c_price(orderInfo.total, 1)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view style="width: 200rpx;">
|
||||
|
@ -89,16 +92,23 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<addressPopup :show="showAddress" @close="showAddress=false" @change="changeAddress" />
|
||||
<addressPopup v-if="addressList.length>0" :show="showAddress" :list="addressList" @close="showAddress=false" @change="changeAddress" />
|
||||
<modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow"
|
||||
@close="addAddress" @change="goPay" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import { nextTick, ref } from "vue"
|
||||
import addressPopup from "@/components/addressPopup.vue";
|
||||
import modal from "@/components/modal.vue"
|
||||
import useCartStore from "@/store/cart.js";
|
||||
import { checkOrderApi } from "@/api/cart.js";
|
||||
import { addressListsApi } from "@/api/user.js";
|
||||
import { createOrderApi } from "@/api/order.js";
|
||||
|
||||
const cartStore = useCartStore();
|
||||
|
||||
const formData = ref({
|
||||
remark: ""
|
||||
|
@ -107,9 +117,29 @@
|
|||
const isAddress = ref(false);
|
||||
const toastAddressShow = ref(false);
|
||||
|
||||
|
||||
// 地址相关
|
||||
const addressList = ref([]);
|
||||
const getAddressList = ()=>{
|
||||
addressListsApi().then(res=>{
|
||||
addressList.value = res.data.lists;
|
||||
addressList.value.forEach(item=>{
|
||||
if(item.is_default) {
|
||||
addressInfo.value = item;
|
||||
isAddress.value = true;
|
||||
}
|
||||
})
|
||||
if(!isAddress.value && addressList.value.length>0){
|
||||
addressInfo.value = addressList.value[0];
|
||||
isAddress.value = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
// 选择地址
|
||||
const showAddress = ref(false);
|
||||
const addressInfo = ref({});
|
||||
const changeAddress = (e) => {
|
||||
addressInfo.value = e;
|
||||
showAddress.value = false;
|
||||
isAddress.value = true;
|
||||
console.log(e);
|
||||
|
@ -132,8 +162,48 @@
|
|||
// 提交订单
|
||||
const submitOrder = () => {
|
||||
if (!isAddress.value) return toastAddressShow.value = true;
|
||||
uni.$u.toast('支付成功')
|
||||
createOrder();
|
||||
}
|
||||
// 订单相关
|
||||
const cartList = ref([]);
|
||||
const orderInfo = ref({});
|
||||
const checkOrder = ()=>{
|
||||
checkOrderApi({
|
||||
cart_id: cartStore.cartList
|
||||
}).then(res=>{
|
||||
cartList.value = res.data.cart_list;
|
||||
orderInfo.value = res.data.order;
|
||||
})
|
||||
}
|
||||
const createOrder = ()=>{
|
||||
createOrderApi({
|
||||
cart_id: cartStore.cartList,
|
||||
address_id: 1,
|
||||
pay_type: 3
|
||||
}).then(res=>{
|
||||
uni.showModal({
|
||||
title: '订单支付成功',
|
||||
confirmText: '查看订单',
|
||||
cancelText: '继续购买',
|
||||
success: (e) => {
|
||||
if(e.confirm) uni.navigateTo({
|
||||
url: '/pagesOrder/order/order'
|
||||
})
|
||||
else uni.navigateBack();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const c_price = (price, index=0)=>{
|
||||
price = price + '';
|
||||
return price.split('.')[index];
|
||||
}
|
||||
|
||||
onLoad(options=>{
|
||||
checkOrder();
|
||||
getAddressList();
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -183,6 +253,8 @@
|
|||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin-right: 20rpx;
|
||||
border-radius: 14rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.body-content {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
// 导入定义仓库的方法
|
||||
import { defineStore } from 'pinia';
|
||||
// 导入响应式和计算
|
||||
import { ref } from 'vue';
|
||||
|
||||
// ##### 由于购物车数量可能很多, 路由跳转时无法携带大量参数, 故使用状态管理保存
|
||||
const useCartStore = defineStore("cart", () => {
|
||||
|
||||
const cartList = ref(uni.getStorageSync('cart_id') || []);
|
||||
const setCartList = (data)=>{
|
||||
cartList.value = data;
|
||||
uni.setStorageSync('cart_id', data);
|
||||
}
|
||||
|
||||
return { cartList, setCartList }
|
||||
})
|
||||
|
||||
export default useCartStore;
|
|
@ -7700,6 +7700,7 @@ const onShow = /* @__PURE__ */ createHook(ON_SHOW);
|
|||
const onLoad = /* @__PURE__ */ createHook(ON_LOAD);
|
||||
exports.Pinia = Pinia;
|
||||
exports._export_sfc = _export_sfc;
|
||||
exports.computed = computed;
|
||||
exports.createPinia = createPinia;
|
||||
exports.createSSRApp = createSSRApp;
|
||||
exports.defineStore = defineStore;
|
||||
|
|
|
@ -21,17 +21,22 @@ const _sfc_main = {
|
|||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
emits: ["close", "change"],
|
||||
setup(__props, { emit: __emit }) {
|
||||
const addressType = common_vendor.ref(-1);
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const close = () => {
|
||||
emit("close");
|
||||
};
|
||||
const submitAddress = () => {
|
||||
emit("change", addressType.value);
|
||||
emit("change", props.list[addressType.value]);
|
||||
};
|
||||
const navTo = (url) => {
|
||||
common_vendor.index.navigateTo({
|
||||
|
@ -50,32 +55,38 @@ const _sfc_main = {
|
|||
color: "#20B128"
|
||||
}),
|
||||
d: common_vendor.o(($event) => navTo("/pagesOrder/addressEdit/addressEdit")),
|
||||
e: common_vendor.f(10, (item, index, i0) => {
|
||||
e: common_vendor.f(__props.list, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: "dc6b9753-3-" + i0 + ",dc6b9753-0",
|
||||
b: addressType.value == index
|
||||
}, addressType.value == index ? {
|
||||
c: common_assets._imports_0$1
|
||||
} : {
|
||||
d: common_assets._imports_1$1
|
||||
}, {
|
||||
e: index,
|
||||
f: common_vendor.o(($event) => addressType.value = index, index)
|
||||
});
|
||||
}),
|
||||
f: common_vendor.p({
|
||||
a: common_vendor.t(item.real_name),
|
||||
b: common_vendor.t(item.phone),
|
||||
c: item.is_default
|
||||
}, item.is_default ? {
|
||||
d: "dc6b9753-3-" + i0 + ",dc6b9753-0",
|
||||
e: common_vendor.p({
|
||||
text: "默认",
|
||||
type: "success",
|
||||
plain: true,
|
||||
size: "mini"
|
||||
})
|
||||
} : {}, {
|
||||
f: common_vendor.t(item.detail),
|
||||
g: addressType.value == index
|
||||
}, addressType.value == index ? {
|
||||
h: common_assets._imports_0$1
|
||||
} : {
|
||||
i: common_assets._imports_1$1
|
||||
}, {
|
||||
j: index,
|
||||
k: common_vendor.o(($event) => addressType.value = index, index)
|
||||
});
|
||||
}),
|
||||
g: common_vendor.o(submitAddress),
|
||||
h: common_vendor.p({
|
||||
f: common_vendor.o(submitAddress),
|
||||
g: common_vendor.p({
|
||||
color: "#20B128",
|
||||
shape: "circle"
|
||||
}),
|
||||
i: common_vendor.o(close),
|
||||
j: common_vendor.p({
|
||||
h: common_vendor.o(close),
|
||||
i: common_vendor.p({
|
||||
show: __props.show,
|
||||
closeable: true,
|
||||
round: "10"
|
||||
|
|
|
@ -1 +1 @@
|
|||
<up-popup wx:if="{{j}}" class="data-v-dc6b9753" u-s="{{['d']}}" bindclose="{{i}}" u-i="dc6b9753-0" bind:__l="__l" u-p="{{j}}"><view class="address-popup data-v-dc6b9753"><view class="head-title data-v-dc6b9753">收货地址</view><view class="list-admin data-v-dc6b9753"><view class="data-v-dc6b9753">常用地址</view><view class="admin-btn data-v-dc6b9753"><view class="btn data-v-dc6b9753" bindtap="{{b}}"><up-icon wx:if="{{a}}" class="data-v-dc6b9753" u-i="dc6b9753-1,dc6b9753-0" bind:__l="__l" u-p="{{a}}"></up-icon>管理</view><view class="btn data-v-dc6b9753" bindtap="{{d}}"><up-icon wx:if="{{c}}" class="data-v-dc6b9753" u-i="dc6b9753-2,dc6b9753-0" bind:__l="__l" u-p="{{c}}"></up-icon>新增</view></view></view><scroll-view class="data-v-dc6b9753" style="height:600rpx;padding-bottom:20rpx" scroll-y><view wx:for="{{e}}" wx:for-item="item" wx:key="e" class="row data-v-dc6b9753" bindtap="{{item.f}}"><view class="content data-v-dc6b9753"><view class="top data-v-dc6b9753"><view class="name data-v-dc6b9753">小李</view><view class="phone data-v-dc6b9753">151****9999</view><u-tag wx:if="{{f}}" class="data-v-dc6b9753" style="pointer-events:none" u-i="{{item.a}}" bind:__l="__l" u-p="{{f}}"></u-tag></view><view class="bottom u-line-2 data-v-dc6b9753">四川泸州市龙马潭区莲花池街道商业街1号</view></view><image wx:if="{{item.b}}" class="data-v-dc6b9753" src="{{item.c}}"></image><image wx:else class="data-v-dc6b9753" src="{{item.d}}"></image></view></scroll-view><up-button wx:if="{{h}}" class="data-v-dc6b9753" u-s="{{['d']}}" bindclick="{{g}}" u-i="dc6b9753-4,dc6b9753-0" bind:__l="__l" u-p="{{h}}">确认</up-button></view></up-popup>
|
||||
<up-popup wx:if="{{i}}" class="data-v-dc6b9753" u-s="{{['d']}}" bindclose="{{h}}" u-i="dc6b9753-0" bind:__l="__l" u-p="{{i}}"><view class="address-popup data-v-dc6b9753"><view class="head-title data-v-dc6b9753">收货地址</view><view class="list-admin data-v-dc6b9753"><view class="data-v-dc6b9753">常用地址</view><view class="admin-btn data-v-dc6b9753"><view class="btn data-v-dc6b9753" bindtap="{{b}}"><up-icon wx:if="{{a}}" class="data-v-dc6b9753" u-i="dc6b9753-1,dc6b9753-0" bind:__l="__l" u-p="{{a}}"></up-icon>管理</view><view class="btn data-v-dc6b9753" bindtap="{{d}}"><up-icon wx:if="{{c}}" class="data-v-dc6b9753" u-i="dc6b9753-2,dc6b9753-0" bind:__l="__l" u-p="{{c}}"></up-icon>新增</view></view></view><scroll-view class="data-v-dc6b9753" style="height:600rpx;padding-bottom:20rpx" scroll-y><view wx:for="{{e}}" wx:for-item="item" wx:key="j" class="row data-v-dc6b9753" bindtap="{{item.k}}"><view class="content data-v-dc6b9753"><view class="top data-v-dc6b9753"><view class="name data-v-dc6b9753">{{item.a}}</view><view class="phone data-v-dc6b9753">{{item.b}}</view><u-tag wx:if="{{item.c}}" class="data-v-dc6b9753" style="pointer-events:none" u-i="{{item.d}}" bind:__l="__l" u-p="{{item.e}}"></u-tag></view><view class="bottom u-line-2 data-v-dc6b9753">{{item.f}}</view></view><image wx:if="{{item.g}}" class="data-v-dc6b9753" src="{{item.h}}"></image><image wx:else class="data-v-dc6b9753" src="{{item.i}}"></image></view></scroll-view><up-button wx:if="{{g}}" class="data-v-dc6b9753" u-s="{{['d']}}" bindclick="{{f}}" u-i="dc6b9753-4,dc6b9753-0" bind:__l="__l" u-p="{{g}}">确认</up-button></view></up-popup>
|
|
@ -19,8 +19,9 @@ const _easycom_up_empty = () => "../../uni_modules/uview-plus/components/u-empty
|
|||
const _easycom_up_button = () => "../../uni_modules/uview-plus/components/u-button/u-button.js";
|
||||
const _easycom_up_transition = () => "../../uni_modules/uview-plus/components/u-transition/u-transition.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_navbar + _easycom_u__icon + _easycom_up_empty + _easycom_up_button + _easycom_up_transition)();
|
||||
(_easycom_up_navbar + _easycom_u__icon + _easycom_up_empty + _easycom_up_button + _easycom_up_transition + goodPopup)();
|
||||
}
|
||||
const goodPopup = () => "../../components/goodPopup.js";
|
||||
const _sfc_main = {
|
||||
__name: "cart",
|
||||
setup(__props) {
|
||||
|
@ -40,13 +41,48 @@ const _sfc_main = {
|
|||
url: "/pagesOrder/settle/settle"
|
||||
});
|
||||
};
|
||||
common_vendor.ref([]);
|
||||
const getcartList = () => {
|
||||
api_cart.cartListApi().then((res) => {
|
||||
console.log(res);
|
||||
const addCart = (id, cart_num) => {
|
||||
api_cart.cartChangeApi({
|
||||
cart_num,
|
||||
is_new: 0,
|
||||
// 是否直接购买0否1是
|
||||
cart_id: id
|
||||
}).then((res) => {
|
||||
getcartList();
|
||||
});
|
||||
};
|
||||
const showGoodPopup = common_vendor.ref(false);
|
||||
const goodRef = common_vendor.ref(null);
|
||||
const goodData = common_vendor.ref({});
|
||||
const openGoodPopup = (item) => {
|
||||
goodData.value = item;
|
||||
goodRef.value.setData(item);
|
||||
showGoodPopup.value = true;
|
||||
};
|
||||
const changeGood = (data) => {
|
||||
showGoodPopup.value = false;
|
||||
addCart(data.cart_id, data.cart_num);
|
||||
};
|
||||
const cartList = common_vendor.ref([]);
|
||||
const cartInfo = common_vendor.ref({});
|
||||
const getcartList = () => {
|
||||
api_cart.cartListApi().then((res) => {
|
||||
var _a, _b;
|
||||
res.data.lists = res.data.lists.map((item) => {
|
||||
item.check = true;
|
||||
return item;
|
||||
});
|
||||
cartList.value = res.data.lists;
|
||||
cartInfo.value = ((_b = (_a = res.data) == null ? void 0 : _a.extend) == null ? void 0 : _b.total_price) || "0.00";
|
||||
});
|
||||
};
|
||||
const c_price = (price = 0, index = 0) => {
|
||||
price = price + "";
|
||||
return price.split(".")[index] || 0;
|
||||
};
|
||||
common_vendor.onShow(() => {
|
||||
getcartList();
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.f(list.value, (item, index, i0) => {
|
||||
|
@ -58,61 +94,72 @@ const _sfc_main = {
|
|||
};
|
||||
}),
|
||||
b: common_vendor.p({
|
||||
placeholder: true
|
||||
})
|
||||
placeholder: true,
|
||||
autoBack: true
|
||||
}),
|
||||
c: common_vendor.t(cartList.value.length)
|
||||
}, {}, {
|
||||
c: common_vendor.f(20, (item, index, i0) => {
|
||||
d: common_vendor.f(cartList.value, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: index % 3 == 0
|
||||
}, index % 3 == 0 ? {
|
||||
a: !item.check
|
||||
}, !item.check ? {
|
||||
b: common_assets._imports_1$1
|
||||
} : {
|
||||
c: common_assets._imports_0$1
|
||||
}, {
|
||||
d: "da603134-1-" + i0,
|
||||
e: "da603134-2-" + i0,
|
||||
f: index
|
||||
d: item.imgs,
|
||||
e: common_vendor.t(item.goods_name),
|
||||
f: common_vendor.t(item.unit_name),
|
||||
g: common_vendor.t(item.goods_total_price),
|
||||
h: common_vendor.t(item.cart_num),
|
||||
i: "da603134-1-" + i0,
|
||||
j: index,
|
||||
k: common_vendor.o(($event) => openGoodPopup(item), index)
|
||||
});
|
||||
}),
|
||||
d: common_vendor.p({
|
||||
name: "minus-circle-fill",
|
||||
size: "20",
|
||||
color: "#20b128"
|
||||
}),
|
||||
e: common_vendor.t(1),
|
||||
f: common_vendor.p({
|
||||
e: common_vendor.p({
|
||||
name: "plus-circle-fill",
|
||||
size: "20",
|
||||
color: "#20b128"
|
||||
})
|
||||
}, {
|
||||
h: common_vendor.f(20, (item, index, i0) => {
|
||||
g: common_vendor.f(20, (item, index, i0) => {
|
||||
return {
|
||||
a: "da603134-4-" + i0,
|
||||
a: "da603134-3-" + i0,
|
||||
b: index
|
||||
};
|
||||
}),
|
||||
i: common_vendor.p({
|
||||
h: common_vendor.p({
|
||||
size: "small",
|
||||
plain: true,
|
||||
color: "#20b128",
|
||||
shape: "circle"
|
||||
})
|
||||
}, {
|
||||
k: swiperCurrent.value,
|
||||
l: common_vendor.o(animationfinish)
|
||||
j: swiperCurrent.value,
|
||||
k: common_vendor.o(animationfinish)
|
||||
}, {
|
||||
n: common_assets._imports_0$1
|
||||
m: common_assets._imports_0$1
|
||||
}, {
|
||||
o: common_vendor.o(settleAccounts),
|
||||
p: common_vendor.p({
|
||||
n: common_vendor.t(c_price(cartInfo.value.total_price, 0)),
|
||||
o: common_vendor.t(c_price(cartInfo.value.total_price, 1)),
|
||||
p: common_vendor.o(settleAccounts),
|
||||
q: common_vendor.p({
|
||||
color: "#20b128",
|
||||
shape: "circle",
|
||||
disabled: false
|
||||
})
|
||||
}, {
|
||||
r: common_vendor.p({
|
||||
s: common_vendor.p({
|
||||
show: tabsActive.value == 0
|
||||
}),
|
||||
t: common_vendor.sr(goodRef, "da603134-8", {
|
||||
"k": "goodRef"
|
||||
}),
|
||||
v: common_vendor.o(($event) => showGoodPopup.value = false),
|
||||
w: common_vendor.o(changeGood),
|
||||
x: common_vendor.p({
|
||||
show: showGoodPopup.value
|
||||
})
|
||||
});
|
||||
};
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"u--icon": "../../uni_modules/uview-plus/components/u-icon/u-icon",
|
||||
"up-empty": "../../uni_modules/uview-plus/components/u-empty/u-empty",
|
||||
"up-button": "../../uni_modules/uview-plus/components/u-button/u-button",
|
||||
"up-transition": "../../uni_modules/uview-plus/components/u-transition/u-transition"
|
||||
"up-transition": "../../uni_modules/uview-plus/components/u-transition/u-transition",
|
||||
"good-popup": "../../components/goodPopup"
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
<view><up-navbar wx:if="{{b}}" u-s="{{['left']}}" u-i="da603134-0" bind:__l="__l" u-p="{{b}}"><view style="display:flex" slot="left"><view wx:for="{{a}}" wx:for-item="item" wx:key="c" class="{{['tabs', item.b && 'tabs-active']}}" bindtap="{{item.d}}">{{item.a}}</view></view></up-navbar><swiper class="swiper-box" current="{{k}}" bindanimationfinish="{{l}}"><swiper-item class="swiper-item"><scroll-view scroll-y style="height:100%;width:100%"><view class="page-box1"><view class="total"><view>共计<text style="color:#20B128">3</text>件</view><view wx:if="{{true}}">管理</view><view wx:else>完成</view></view><view wx:if="{{true}}" class="list" style="margin-top:80rpx"><view wx:for="{{c}}" wx:for-item="item" wx:key="f" class="shop-item"><view class="shop-check"><image wx:if="{{item.a}}" src="{{item.b}}"></image><image wx:else src="{{item.c}}"></image></view><image class="shop-img" src="https://cdn.uviewui.com/uview/album/1.jpg"></image><view class="shop-content"><view class="title"><view class="name u-line-2">好吃的瓜果</view><view class="tip u-line-1">香味辛辣|葱香味浓|调味增香香味辛辣|葱香味浓|调味增香</view></view><view class="price-btn"><view class="price">¥12.00</view><view class="btn"><u--icon wx:if="{{d}}" u-i="{{item.d}}" bind:__l="__l" u-p="{{d}}"></u--icon><view class="num">{{e}}</view><u--icon wx:if="{{f}}" u-i="{{item.e}}" bind:__l="__l" u-p="{{f}}"></u--icon></view></view></view></view></view><view wx:else style="margin-top:100rpx"><up-empty wx:if="{{g}}" u-i="da603134-3" bind:__l="__l" u-p="{{g}}"></up-empty></view><view style="width:100%;height:200rpx"></view></view></scroll-view></swiper-item><swiper-item class="swiper-item"><scroll-view scroll-y style="height:100%;width:100%"><view class="page-box1"><view wx:if="{{true}}" class="list"><view wx:for="{{h}}" wx:for-item="item" wx:key="b" class="shop-item"><image class="shop-img" src="https://cdn.uviewui.com/uview/album/1.jpg"></image><view class="shop-content" style="width:490rpx"><view class="title"><view class="name u-line-2">好吃的瓜果</view><view class="tip u-line-1">香味辛辣|葱香味浓|调味增香香味辛辣|葱香味浓|调味增香</view></view><view class="price-btn"><view class="price">¥12.00</view><view class="btn"><up-button wx:if="{{i}}" u-s="{{['d']}}" u-i="{{item.a}}" bind:__l="__l" u-p="{{i}}">加入购物车</up-button></view></view></view></view></view><view wx:else style="margin-top:100rpx"><up-empty wx:if="{{j}}" u-i="da603134-5" bind:__l="__l" u-p="{{j}}"></up-empty></view><view style="width:100%;height:200rpx"></view></view></scroll-view></swiper-item></swiper><up-transition wx:if="{{r}}" u-s="{{['d']}}" u-i="da603134-6" bind:__l="__l" u-p="{{r}}"><view class="cart-btn"><view class="cart-check"><image wx:if="{{false}}" src="{{m}}"></image><image wx:else src="{{n}}"></image><text style="font-size:24rpx">全选</text></view><view wx:if="{{true}}" class="btn-boxs"><view class="all-price"><view style="width:80rpx">合计:</view><view class="price"><text style="font-size:24rpx">¥</text><text style="font-size:34rpx">20</text><text style="font-size:24rpx">.30</text></view></view><up-button wx:if="{{p}}" u-s="{{['d']}}" bindclick="{{o}}" u-i="da603134-7,da603134-6" bind:__l="__l" u-p="{{p}}">去结算<text>(2)</text></up-button></view><view wx:else class="btn-boxs"><view style="width:80px"><up-button wx:if="{{q}}" u-s="{{['d']}}" u-i="da603134-8,da603134-6" bind:__l="__l" u-p="{{q}}">删除</up-button></view></view></view></up-transition></view>
|
||||
<view><up-navbar wx:if="{{b}}" u-s="{{['center']}}" u-i="da603134-0" bind:__l="__l" u-p="{{b}}"><view style="display:flex;align-items:center;width:100%;justify-content:flex-start;margin-left:100rpx" slot="center"><view wx:for="{{a}}" wx:for-item="item" wx:key="c" class="{{['tabs', item.b && 'tabs-active']}}" bindtap="{{item.d}}">{{item.a}}</view></view></up-navbar><swiper class="swiper-box" current="{{j}}" bindanimationfinish="{{k}}"><swiper-item class="swiper-item"><scroll-view scroll-y style="height:100%;width:100%"><view class="page-box1"><view class="total"><view>共计<text style="color:#20B128">{{c}}</text>件</view><view wx:if="{{true}}">管理</view><view wx:else>完成</view></view><view wx:if="{{true}}" class="list" style="margin-top:80rpx"><view wx:for="{{d}}" wx:for-item="item" wx:key="j" class="shop-item" bindtap="{{item.k}}"><view class="shop-check"><image wx:if="{{item.a}}" src="{{item.b}}"></image><image wx:else src="{{item.c}}"></image></view><image class="shop-img" src="{{item.d}}"></image><view class="shop-content"><view class="title"><view class="name u-line-2">{{item.e}}</view><view class="tip u-line-1">{{item.f}}</view></view><view class="price-btn"><view class="price">¥{{item.g}}</view><view class="btn"><view class="num">{{item.h}}</view><u--icon wx:if="{{e}}" u-i="{{item.i}}" bind:__l="__l" u-p="{{e}}"></u--icon></view></view></view></view></view><view wx:else style="margin-top:100rpx"><up-empty wx:if="{{f}}" u-i="da603134-2" bind:__l="__l" u-p="{{f}}"></up-empty></view><view style="width:100%;height:200rpx"></view></view></scroll-view></swiper-item><swiper-item class="swiper-item"><scroll-view scroll-y style="height:100%;width:100%"><view class="page-box1"><view wx:if="{{true}}" class="list"><view wx:for="{{g}}" wx:for-item="item" wx:key="b" class="shop-item"><image class="shop-img" src="https://cdn.uviewui.com/uview/album/1.jpg"></image><view class="shop-content" style="width:490rpx"><view class="title"><view class="name u-line-2">好吃的瓜果</view><view class="tip u-line-1">香味辛辣|葱香味浓|调味增香香味辛辣|葱香味浓|调味增香</view></view><view class="price-btn"><view class="price">¥12.00</view><view class="btn"><up-button wx:if="{{h}}" u-s="{{['d']}}" u-i="{{item.a}}" bind:__l="__l" u-p="{{h}}">加入购物车</up-button></view></view></view></view></view><view wx:else style="margin-top:100rpx"><up-empty wx:if="{{i}}" u-i="da603134-4" bind:__l="__l" u-p="{{i}}"></up-empty></view><view style="width:100%;height:200rpx"></view></view></scroll-view></swiper-item></swiper><up-transition wx:if="{{s}}" u-s="{{['d']}}" u-i="da603134-5" bind:__l="__l" u-p="{{s}}"><view class="cart-btn"><view class="cart-check"><image wx:if="{{false}}" src="{{l}}"></image><image wx:else src="{{m}}"></image><text style="font-size:24rpx">全选</text></view><view wx:if="{{true}}" class="btn-boxs"><view class="all-price"><view style="width:80rpx">合计:</view><view class="price"><text style="font-size:24rpx">¥</text><text style="font-size:34rpx">{{n}}</text><text style="font-size:24rpx">.{{o}}</text></view></view><up-button wx:if="{{q}}" u-s="{{['d']}}" bindclick="{{p}}" u-i="da603134-6,da603134-5" bind:__l="__l" u-p="{{q}}">去结算<text>(2)</text></up-button></view><view wx:else class="btn-boxs"><view style="width:80px"><up-button wx:if="{{r}}" u-s="{{['d']}}" u-i="da603134-7,da603134-5" bind:__l="__l" u-p="{{r}}">删除</up-button></view></view></view></up-transition><good-popup wx:if="{{x}}" class="r" u-r="goodRef" bindclose="{{v}}" bindchange="{{w}}" u-i="da603134-8" bind:__l="__l" u-p="{{x}}"/></view>
|
|
@ -3,6 +3,7 @@ const common_vendor = require("../../common/vendor.js");
|
|||
const common_assets = require("../../common/assets.js");
|
||||
const api_good = require("../../api/good.js");
|
||||
const api_cart = require("../../api/cart.js");
|
||||
const store_cart = require("../../store/cart.js");
|
||||
require("../../utils/request.js");
|
||||
require("../../config/app.js");
|
||||
require("../../store/user.js");
|
||||
|
@ -12,24 +13,24 @@ if (!Array) {
|
|||
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
|
||||
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
|
||||
const _easycom_u__icon2 = common_vendor.resolveComponent("u--icon");
|
||||
const _easycom_up_transition2 = common_vendor.resolveComponent("up-transition");
|
||||
const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
|
||||
(_easycom_up_navbar2 + _easycom_up_search2 + _easycom_up_image2 + _easycom_up_icon2 + _easycom_u__icon2 + _easycom_up_transition2 + _easycom_up_button2)();
|
||||
(_easycom_up_navbar2 + _easycom_up_search2 + _easycom_up_image2 + _easycom_up_icon2 + _easycom_u__icon2 + _easycom_up_button2)();
|
||||
}
|
||||
const _easycom_up_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
|
||||
const _easycom_up_search = () => "../../uni_modules/uview-plus/components/u-search/u-search.js";
|
||||
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
|
||||
const _easycom_up_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
|
||||
const _easycom_u__icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
|
||||
const _easycom_up_transition = () => "../../uni_modules/uview-plus/components/u-transition/u-transition.js";
|
||||
const _easycom_up_button = () => "../../uni_modules/uview-plus/components/u-button/u-button.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_navbar + _easycom_up_search + _easycom_up_image + _easycom_up_icon + viewPopup + _easycom_u__icon + _easycom_up_transition + _easycom_up_button)();
|
||||
(_easycom_up_navbar + _easycom_up_search + _easycom_up_image + _easycom_up_icon + viewPopup + _easycom_u__icon + _easycom_up_button + goodPopup)();
|
||||
}
|
||||
const viewPopup = () => "../../components/viewPopup.js";
|
||||
const goodPopup = () => "../../components/goodPopup.js";
|
||||
const _sfc_main = {
|
||||
__name: "index",
|
||||
setup(__props) {
|
||||
const cartStore = store_cart.useCartStore();
|
||||
const show = common_vendor.ref(0);
|
||||
const topActive = common_vendor.ref(0);
|
||||
const changeOne = (item, index) => {
|
||||
|
@ -39,8 +40,9 @@ const _sfc_main = {
|
|||
show.value = 0;
|
||||
goodClassTow.value = (item == null ? void 0 : item.children) || [];
|
||||
goodClassThree.value = ((_a = goodClassTow.value[0]) == null ? void 0 : _a.children) || [];
|
||||
leftActive.value = (_b = goodClassTow.value[0]) == null ? void 0 : _b.id;
|
||||
rightActive.value = (_c = goodClassThree.value[0]) == null ? void 0 : _c.id;
|
||||
leftActive.value = ((_b = goodClassTow.value[0]) == null ? void 0 : _b.id) || "";
|
||||
rightActive.value = ((_c = goodClassThree.value[0]) == null ? void 0 : _c.id) || "";
|
||||
getGoodList();
|
||||
};
|
||||
const leftActive = common_vendor.ref(0);
|
||||
const changeTwo = (item, index) => {
|
||||
|
@ -49,18 +51,20 @@ const _sfc_main = {
|
|||
leftActive.value = item.id;
|
||||
show.value = 0;
|
||||
goodClassThree.value = (item == null ? void 0 : item.children) || [];
|
||||
rightActive.value = (_a = goodClassThree.value[0]) == null ? void 0 : _a.id;
|
||||
rightActive.value = ((_a = goodClassThree.value[0]) == null ? void 0 : _a.id) || "";
|
||||
getGoodList();
|
||||
};
|
||||
const rightActive = common_vendor.ref(0);
|
||||
const changeThree = (item, index) => {
|
||||
console.log("选择", item, index);
|
||||
rightActive.value = item.id;
|
||||
show.value = 0;
|
||||
getGoodList();
|
||||
};
|
||||
const cartList = common_vendor.reactive(/* @__PURE__ */ new Map());
|
||||
const addCart = (id) => {
|
||||
const addCart = (id, cart_num) => {
|
||||
api_cart.cartCreateApi({
|
||||
cart_num: 1,
|
||||
cart_num,
|
||||
is_new: 0,
|
||||
// 是否直接购买0否1是
|
||||
goods_id: id
|
||||
|
@ -68,41 +72,47 @@ const _sfc_main = {
|
|||
console.log(res);
|
||||
let now = cartList.get(id) || 0;
|
||||
cartList.set(id, now + 1);
|
||||
});
|
||||
};
|
||||
const removeCart = (id) => {
|
||||
let num = cartList.get(id) || 0;
|
||||
if (num == 0)
|
||||
return;
|
||||
api_cart.cartChangeApi({
|
||||
goods_id: id,
|
||||
cart_num: num--
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
cartList.set(id, num);
|
||||
getCartList();
|
||||
});
|
||||
};
|
||||
const keyword = common_vendor.ref("");
|
||||
const searchKeyword = () => {
|
||||
console.log("搜索", keyword.value);
|
||||
where.value = keyword.value;
|
||||
where.value.name = keyword.value;
|
||||
getGoodList();
|
||||
};
|
||||
const changeOrder = (order) => {
|
||||
console.log("排序", order);
|
||||
where.value.order = order;
|
||||
};
|
||||
const where = common_vendor.ref({
|
||||
page: 1,
|
||||
pageSize: 25,
|
||||
keyword: "",
|
||||
page_no: 1,
|
||||
page_size: 25,
|
||||
name: "",
|
||||
order: ""
|
||||
});
|
||||
const loading = common_vendor.ref(true);
|
||||
const goodList = common_vendor.ref([]);
|
||||
const getGoodList = () => {
|
||||
const getGoodList = (loadmore = false) => {
|
||||
loading.value = true;
|
||||
api_good.goodListApi(where.value).then((res) => {
|
||||
goodList.value = [...goodList.value, ...res.data.lists];
|
||||
let class_id = rightActive.value || leftActive.value || topActive.value || "";
|
||||
let class_all = "";
|
||||
if (rightActive.value == "")
|
||||
class_all = leftActive.value;
|
||||
if (leftActive.value == "")
|
||||
class_all = topActive.value;
|
||||
if (topActive.value == "")
|
||||
class_all = "";
|
||||
if (class_all)
|
||||
class_id = "";
|
||||
api_good.goodListApi({
|
||||
...where.value,
|
||||
class_all,
|
||||
class: class_id
|
||||
}).then((res) => {
|
||||
if (loadmore)
|
||||
goodList.value.push(...res.data.lists);
|
||||
else
|
||||
goodList.value = res.data.lists;
|
||||
});
|
||||
};
|
||||
const loadMoreGood = () => {
|
||||
|
@ -113,13 +123,41 @@ const _sfc_main = {
|
|||
const goodClassThree = common_vendor.ref([]);
|
||||
const getgoodClassList = () => {
|
||||
api_good.goodClassListApi().then((res) => {
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
goodClassList.value = ((_a = res.data) == null ? void 0 : _a.lists) || [];
|
||||
goodClassTow.value = ((_b = goodClassList.value[0]) == null ? void 0 : _b.children) || [];
|
||||
goodClassThree.value = ((_c = goodClassTow.value[0]) == null ? void 0 : _c.children) || [];
|
||||
topActive.value = (_d = goodClassList.value[0]) == null ? void 0 : _d.id;
|
||||
leftActive.value = (_e = goodClassTow.value[0]) == null ? void 0 : _e.id;
|
||||
rightActive.value = (_f = goodClassThree.value[0]) == null ? void 0 : _f.id;
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h;
|
||||
(_b = (_a = res.data) == null ? void 0 : _a.lists) == null ? void 0 : _b.unshift({
|
||||
id: "",
|
||||
name: "全部",
|
||||
pic: "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png",
|
||||
children: []
|
||||
});
|
||||
res.data.lists = res.data.lists.map((item) => {
|
||||
var _a2;
|
||||
if (!item.children)
|
||||
item.children = [];
|
||||
(_a2 = item.children) == null ? void 0 : _a2.unshift({
|
||||
id: "",
|
||||
pid: item.id,
|
||||
name: "全部"
|
||||
});
|
||||
item.children = item.children.map((t) => {
|
||||
var _a3;
|
||||
if (!t.children)
|
||||
t.children = [];
|
||||
(_a3 = t.children) == null ? void 0 : _a3.unshift({
|
||||
id: "",
|
||||
pid: t.id,
|
||||
name: "全部"
|
||||
});
|
||||
return t;
|
||||
});
|
||||
return item;
|
||||
});
|
||||
goodClassList.value = ((_c = res.data) == null ? void 0 : _c.lists) || [];
|
||||
goodClassTow.value = ((_d = goodClassList.value[0]) == null ? void 0 : _d.children) || [];
|
||||
goodClassThree.value = ((_e = goodClassTow.value[0]) == null ? void 0 : _e.children) || [];
|
||||
topActive.value = (_f = goodClassList.value[0]) == null ? void 0 : _f.id;
|
||||
leftActive.value = (_g = goodClassTow.value[0]) == null ? void 0 : _g.id;
|
||||
rightActive.value = (_h = goodClassThree.value[0]) == null ? void 0 : _h.id;
|
||||
});
|
||||
};
|
||||
const navTo = (url) => {
|
||||
|
@ -127,10 +165,47 @@ const _sfc_main = {
|
|||
url
|
||||
});
|
||||
};
|
||||
const showGoodPopup = common_vendor.ref(false);
|
||||
const goodRef = common_vendor.ref(null);
|
||||
const goodData = common_vendor.ref({});
|
||||
const openGoodPopup = (item) => {
|
||||
goodData.value = item;
|
||||
goodRef.value.setData(item);
|
||||
showGoodPopup.value = true;
|
||||
};
|
||||
const changeGood = (data) => {
|
||||
showGoodPopup.value = false;
|
||||
addCart(data.id, data.cart_num);
|
||||
};
|
||||
const settleAccounts = () => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pagesOrder/settle/settle"
|
||||
});
|
||||
};
|
||||
const cartInfo = common_vendor.ref({
|
||||
total_price: "0.00",
|
||||
count: 0
|
||||
});
|
||||
const getCartList = (res) => {
|
||||
api_cart.cartListApi({
|
||||
page_no: 1,
|
||||
page_size: 100
|
||||
}).then((res2) => {
|
||||
var _a, _b, _c, _d;
|
||||
cartInfo.value = {
|
||||
total_price: ((_b = (_a = res2.data) == null ? void 0 : _a.extend) == null ? void 0 : _b.total_price) || "0.00",
|
||||
count: ((_c = res2.data) == null ? void 0 : _c.count) || 0
|
||||
};
|
||||
cartStore.setCartList((_d = res2.data) == null ? void 0 : _d.lists.map((item) => item.cart_id));
|
||||
});
|
||||
};
|
||||
common_vendor.onLoad(() => {
|
||||
getgoodClassList();
|
||||
getGoodList();
|
||||
});
|
||||
common_vendor.onShow(() => {
|
||||
getCartList();
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.p({
|
||||
|
@ -156,7 +231,7 @@ const _sfc_main = {
|
|||
src: item.pic
|
||||
}),
|
||||
c: common_vendor.t(item.name),
|
||||
d: topActive.value == item.id ? 1 : "",
|
||||
d: topActive.value === item.id ? 1 : "",
|
||||
e: index,
|
||||
f: common_vendor.o(($event) => changeOne(item, index), index)
|
||||
};
|
||||
|
@ -176,7 +251,7 @@ const _sfc_main = {
|
|||
src: item.pic
|
||||
}),
|
||||
c: common_vendor.t(item.name),
|
||||
d: topActive.value == item.id ? 1 : "",
|
||||
d: topActive.value === item.id ? 1 : "",
|
||||
e: index,
|
||||
f: common_vendor.o(($event) => changeOne(item, index), index)
|
||||
};
|
||||
|
@ -189,7 +264,7 @@ const _sfc_main = {
|
|||
p: common_vendor.f(goodClassTow.value, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.name),
|
||||
b: leftActive.value == item.id ? 1 : "",
|
||||
b: leftActive.value === item.id ? 1 : "",
|
||||
c: index,
|
||||
d: common_vendor.o(($event) => changeTwo(item, index), index)
|
||||
};
|
||||
|
@ -197,7 +272,7 @@ const _sfc_main = {
|
|||
q: common_vendor.f(goodClassThree.value, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.name),
|
||||
b: rightActive.value == item.id ? 1 : "",
|
||||
b: rightActive.value === item.id ? 1 : "",
|
||||
c: index,
|
||||
d: common_vendor.o(($event) => changeThree(item, index), index)
|
||||
};
|
||||
|
@ -217,7 +292,7 @@ const _sfc_main = {
|
|||
B: common_vendor.f(goodClassThree.value, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.name),
|
||||
b: rightActive.value == item.id ? 1 : "",
|
||||
b: rightActive.value === item.id ? 1 : "",
|
||||
c: index,
|
||||
d: common_vendor.o(($event) => changeThree(item, index), index)
|
||||
};
|
||||
|
@ -237,37 +312,34 @@ const _sfc_main = {
|
|||
e: common_vendor.t(item.class_name),
|
||||
f: common_vendor.t(item.unit_name),
|
||||
g: common_vendor.t(item.sell),
|
||||
h: common_vendor.o(($event) => removeCart(item.id), item.id),
|
||||
i: "1ba6254c-10-" + i0 + "," + ("1ba6254c-9-" + i0),
|
||||
j: "1ba6254c-9-" + i0,
|
||||
k: common_vendor.p({
|
||||
show: cartList.get(item.id) > 0
|
||||
}),
|
||||
l: common_vendor.t(cartList.get(item.id)),
|
||||
m: "1ba6254c-11-" + i0,
|
||||
n: common_vendor.p({
|
||||
show: cartList.get(item.id) > 0
|
||||
}),
|
||||
o: common_vendor.o(($event) => addCart(item.id), item.id),
|
||||
p: "1ba6254c-12-" + i0,
|
||||
q: item.id
|
||||
h: "1ba6254c-9-" + i0,
|
||||
i: item.id,
|
||||
j: common_vendor.o(($event) => openGoodPopup(item), item.id)
|
||||
};
|
||||
}),
|
||||
E: common_vendor.p({
|
||||
name: "minus-circle-fill",
|
||||
size: "20",
|
||||
color: "#20b128"
|
||||
}),
|
||||
F: common_vendor.p({
|
||||
name: "plus-circle-fill",
|
||||
size: "20",
|
||||
color: "#20b128"
|
||||
}),
|
||||
G: common_vendor.o(loadMoreGood),
|
||||
H: common_vendor.p({
|
||||
color: "#20b128"
|
||||
F: common_vendor.o(loadMoreGood),
|
||||
G: common_vendor.t(cartInfo.value.total_price),
|
||||
H: common_vendor.o(settleAccounts),
|
||||
I: common_vendor.p({
|
||||
color: "#20b128",
|
||||
disabled: cartInfo.value.count == 0
|
||||
}),
|
||||
I: common_assets._imports_2
|
||||
J: common_assets._imports_2,
|
||||
K: common_vendor.t(cartInfo.value.count),
|
||||
L: common_vendor.o(($event) => navTo("/pages/cart/cart")),
|
||||
M: common_vendor.sr(goodRef, "1ba6254c-11", {
|
||||
"k": "goodRef"
|
||||
}),
|
||||
N: common_vendor.o(($event) => showGoodPopup.value = false),
|
||||
O: common_vendor.o(changeGood),
|
||||
P: common_vendor.p({
|
||||
show: showGoodPopup.value
|
||||
})
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
"up-image": "../../uni_modules/uview-plus/components/u-image/u-image",
|
||||
"up-icon": "../../uni_modules/uview-plus/components/u-icon/u-icon",
|
||||
"u--icon": "../../uni_modules/uview-plus/components/u-icon/u-icon",
|
||||
"up-transition": "../../uni_modules/uview-plus/components/u-transition/u-transition",
|
||||
"up-button": "../../uni_modules/uview-plus/components/u-button/u-button",
|
||||
"view-popup": "../../components/viewPopup"
|
||||
"view-popup": "../../components/viewPopup",
|
||||
"good-popup": "../../components/goodPopup"
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
<view class="content"><up-navbar wx:if="{{a}}" u-s="{{['left']}}" style="z-index:10080" u-i="1ba6254c-0" bind:__l="__l" u-p="{{a}}"><view style="font-size:30rpx;font-weight:bold" slot="left">里海商户采购平台</view></up-navbar><view class="navbar"><view style="width:500rpx"><up-search wx:if="{{d}}" bindsearch="{{b}}" u-i="1ba6254c-1" bind:__l="__l" bindupdateModelValue="{{c}}" u-p="{{d}}"></up-search></view><view class="nav-item" bindtap="{{f}}"><image src="{{e}}"></image><text>购物车</text></view><view class="nav-item" bindtap="{{h}}"><image src="{{g}}"></image><text>个人中心</text></view></view><view style="position:relative;overflow:hidden"><scroll-view class="head-view" scroll-x><view class="list"><view wx:for="{{i}}" wx:for-item="item" wx:key="e" class="{{['item', item.d && 'item-active']}}" bindtap="{{item.f}}"><view class="c-img"><up-image wx:if="{{item.b}}" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></up-image></view><view class="c-text u-line-1">{{item.c}}</view></view><view class="item" style="width:80rpx;height:20rpx"></view></view></scroll-view><view class="r-btn" bindtap="{{k}}"><view>全</view><view>部</view><up-icon wx:if="{{j}}" u-i="1ba6254c-3" bind:__l="__l" u-p="{{j}}"></up-icon></view></view><view-popup wx:if="{{l}}" u-s="{{['d']}}" bindclose="{{n}}" u-i="1ba6254c-4" bind:__l="__l" u-p="{{o}}"><view class="cateOne"><view class="head-title">全部分类</view><scroll-view scroll-y style="height:600rpx"><view class="list"><view wx:for="{{m}}" wx:for-item="item" wx:key="e" class="{{['item', item.d && 'item-active']}}" bindtap="{{item.f}}"><view class="c-img"><up-image wx:if="{{item.b}}" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></up-image></view><view class="c-text u-line-1">{{item.c}}</view></view></view></scroll-view></view></view-popup><view class="scroll-box"><scroll-view class="left" scroll-y><view wx:for="{{p}}" wx:for-item="item" wx:key="c" class="{{['item', 'u-line-1', item.b && 'item-active']}}" bindtap="{{item.d}}">{{item.a}}</view><view style="width:100%;height:300rpx"></view></scroll-view><view class="right"><view class="classify"><scroll-view style="height:90rpx" scroll-x><view class="classify-list"><view wx:for="{{q}}" wx:for-item="item" wx:key="c" class="{{['classify-list-item', 'u-line-1', item.b && 'item-active']}}" bindtap="{{item.d}}">{{item.a}}</view><view style="width:70rpx;flex-shrink:0"></view></view></scroll-view><view class="done" bindtap="{{s}}"><up-icon wx:if="{{r}}" u-i="1ba6254c-6" bind:__l="__l" u-p="{{r}}"></up-icon></view><view class="order-by"><view class="{{['item', t && 'order-active']}}" bindtap="{{v}}">综合</view><view class="{{['item', w && 'order-active']}}" bindtap="{{x}}">价格</view><view class="{{['item', y && 'order-active']}}" bindtap="{{z}}">销量</view></view></view><view-popup wx:if="{{A}}" u-s="{{['d']}}" bindclose="{{C}}" u-i="1ba6254c-7" bind:__l="__l"><view class="cateOne"><scroll-view scroll-y style="height:230rpx"><view class="classify-list"><view wx:for="{{B}}" wx:for-item="item" wx:key="c" class="{{['classify-list-item', 'u-line-1', item.b && 'item-active']}}" bindtap="{{item.d}}">{{item.a}}</view></view></scroll-view></view></view-popup><scroll-view class="list" scroll-y bindscrolltolower="{{G}}"><view wx:for="{{D}}" wx:for-item="item" wx:key="q" class="shop-item"><view class="shop-img"><up-image wx:if="{{item.b}}" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></up-image></view><view class="shop-content"><view class="title"><view class="name u-line-2">{{item.c}}</view><view class="tip u-line-1"><text>{{item.d}}|</text><text>{{item.e}}|</text><text>{{item.f}}</text></view></view><view class="price-btn"><view class="price">¥{{item.g}}</view><view class="btn"><up-transition wx:if="{{item.k}}" u-s="{{['d']}}" u-i="{{item.j}}" bind:__l="__l" u-p="{{item.k}}"><u--icon wx:if="{{E}}" bindclick="{{item.h}}" u-i="{{item.i}}" bind:__l="__l" u-p="{{E}}"></u--icon></up-transition><up-transition wx:if="{{item.n}}" u-s="{{['d']}}" u-i="{{item.m}}" bind:__l="__l" u-p="{{item.n}}"><view class="num">{{item.l}}</view></up-transition><u--icon wx:if="{{F}}" bindclick="{{item.o}}" u-i="{{item.p}}" bind:__l="__l" u-p="{{F}}"></u--icon></view></view></view></view><view style="width:100%;height:300rpx"></view></scroll-view></view></view><view class="fiexd-btn-box"><view class="price-info"><view class="row"><view>合计</view><view class="price">¥<text style="font-size:36rpx">50.00</text></view></view><view class="row"><view>原价 ¥50.00</view><view class="price">优惠 ¥0.00</view></view></view><view class="btn"><up-button wx:if="{{H}}" u-s="{{['d']}}" u-i="1ba6254c-13" bind:__l="__l" u-p="{{H}}">结算</up-button></view><view class="cart"><image src="{{I}}"></image></view></view></view>
|
||||
<view class="content"><up-navbar wx:if="{{a}}" u-s="{{['left']}}" style="z-index:10080" u-i="1ba6254c-0" bind:__l="__l" u-p="{{a}}"><view style="font-size:30rpx;font-weight:bold" slot="left">惠农批发</view></up-navbar><view class="navbar"><view style="width:500rpx"><up-search wx:if="{{d}}" bindsearch="{{b}}" u-i="1ba6254c-1" bind:__l="__l" bindupdateModelValue="{{c}}" u-p="{{d}}"></up-search></view><view class="nav-item" bindtap="{{f}}"><image src="{{e}}"></image><text>购物车</text></view><view class="nav-item" bindtap="{{h}}"><image src="{{g}}"></image><text>个人中心</text></view></view><view style="position:relative;overflow:hidden"><scroll-view class="head-view" scroll-x><view class="list"><view wx:for="{{i}}" wx:for-item="item" wx:key="e" class="{{['item', item.d && 'item-active']}}" bindtap="{{item.f}}"><view class="c-img"><up-image wx:if="{{item.b}}" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></up-image></view><view class="c-text u-line-1">{{item.c}}</view></view><view class="item" style="width:80rpx;height:20rpx"></view></view></scroll-view><view class="r-btn" bindtap="{{k}}"><view>全</view><view>部</view><up-icon wx:if="{{j}}" u-i="1ba6254c-3" bind:__l="__l" u-p="{{j}}"></up-icon></view></view><view-popup wx:if="{{l}}" u-s="{{['d']}}" bindclose="{{n}}" u-i="1ba6254c-4" bind:__l="__l" u-p="{{o}}"><view class="cateOne"><view class="head-title">全部分类</view><scroll-view scroll-y style="height:600rpx"><view class="list"><view wx:for="{{m}}" wx:for-item="item" wx:key="e" class="{{['item', item.d && 'item-active']}}" bindtap="{{item.f}}"><view class="c-img"><up-image wx:if="{{item.b}}" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></up-image></view><view class="c-text u-line-1">{{item.c}}</view></view></view></scroll-view></view></view-popup><view class="scroll-box"><scroll-view class="left" scroll-y><view wx:for="{{p}}" wx:for-item="item" wx:key="c" class="{{['item', 'u-line-1', item.b && 'item-active']}}" bindtap="{{item.d}}">{{item.a}}</view><view style="width:100%;height:300rpx"></view></scroll-view><view class="right"><view class="classify"><scroll-view style="height:90rpx" scroll-x><view class="classify-list"><view wx:for="{{q}}" wx:for-item="item" wx:key="c" class="{{['classify-list-item', 'u-line-1', item.b && 'item-active']}}" bindtap="{{item.d}}">{{item.a}}</view><view style="width:70rpx;flex-shrink:0"></view></view></scroll-view><view class="done" bindtap="{{s}}"><up-icon wx:if="{{r}}" u-i="1ba6254c-6" bind:__l="__l" u-p="{{r}}"></up-icon></view><view class="order-by"><view class="{{['item', t && 'order-active']}}" bindtap="{{v}}">综合</view><view class="{{['item', w && 'order-active']}}" bindtap="{{x}}">价格</view><view class="{{['item', y && 'order-active']}}" bindtap="{{z}}">销量</view></view></view><view-popup wx:if="{{A}}" u-s="{{['d']}}" bindclose="{{C}}" u-i="1ba6254c-7" bind:__l="__l"><view class="cateOne"><scroll-view scroll-y style="height:230rpx"><view class="classify-list"><view wx:for="{{B}}" wx:for-item="item" wx:key="c" class="{{['classify-list-item', 'u-line-1', item.b && 'item-active']}}" bindtap="{{item.d}}">{{item.a}}</view></view></scroll-view></view></view-popup><scroll-view class="list" scroll-y bindscrolltolower="{{F}}"><view wx:for="{{D}}" wx:for-item="item" wx:key="i" class="shop-item" bindtap="{{item.j}}"><view class="shop-img"><up-image wx:if="{{item.b}}" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></up-image></view><view class="shop-content"><view class="title"><view class="name u-line-2">{{item.c}}</view><view class="tip u-line-1"><text>{{item.d}}|</text><text>{{item.e}}|</text><text>{{item.f}}</text></view></view><view class="price-btn"><view class="price">¥{{item.g}}</view><view class="btn"><u--icon wx:if="{{E}}" u-i="{{item.h}}" bind:__l="__l" u-p="{{E}}"></u--icon></view></view></view></view><view style="width:100%;height:300rpx"></view></scroll-view></view></view><view class="fiexd-btn-box"><view class="price-info"><view class="row"><view>合计</view><view class="price">¥<text style="font-size:36rpx">{{G}}</text></view></view></view><view class="btn"><up-button wx:if="{{I}}" u-s="{{['d']}}" bindclick="{{H}}" u-i="1ba6254c-10" bind:__l="__l" u-p="{{I}}">结算</up-button></view><view class="cart" bindtap="{{L}}"><image src="{{J}}"></image><view class="badge">{{K}}</view></view></view><good-popup wx:if="{{P}}" class="r" u-r="goodRef" bindclose="{{N}}" bindchange="{{O}}" u-i="1ba6254c-11" bind:__l="__l" u-p="{{P}}"/></view>
|
|
@ -338,3 +338,16 @@
|
|||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
}
|
||||
.fiexd-btn-box .cart .badge {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
background-color: #F55726;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
text-align: center;
|
||||
line-height: 26rpx;
|
||||
font-size: 18rpx;
|
||||
}
|
|
@ -1 +1 @@
|
|||
<view><up-navbar wx:if="{{b}}" bindleftClick="{{a}}" u-i="23c3038c-0" bind:__l="__l" u-p="{{b}}"></up-navbar><view class="login-box"><image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png"></image><view class="tips">欢迎登录里海商户采购平台</view><block wx:if="{{c}}"><up-transition wx:if="{{i}}" u-s="{{['d']}}" u-i="23c3038c-1" bind:__l="__l" u-p="{{i}}"><view class="btn"><up-button wx:if="{{f}}" u-s="{{['d']}}" bindgetphonenumber="{{e}}" u-i="23c3038c-2,23c3038c-1" bind:__l="__l" u-p="{{f}}"><up-icon wx:if="{{d}}" u-i="23c3038c-3,23c3038c-2" bind:__l="__l" u-p="{{d}}"></up-icon>微信授权手机号登录</up-button></view><view class="btn"><up-button wx:if="{{h}}" u-s="{{['d']}}" bindclick="{{g}}" u-i="23c3038c-4,23c3038c-1" bind:__l="__l" u-p="{{h}}"><text style="color:#20B128">使用短信验证登录</text></up-button></view></up-transition></block><block wx:else><up-transition wx:if="{{v}}" u-s="{{['d']}}" u-i="23c3038c-5" bind:__l="__l" u-p="{{v}}"><view class="form"><view class="input"><up-input wx:if="{{k}}" u-s="{{['prefix']}}" u-i="23c3038c-6,23c3038c-5" bind:__l="__l" bindupdateModelValue="{{j}}" u-p="{{k}}"><image style="height:40rpx;width:40rpx;margin-top:6rpx" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png" slot="prefix"></image></up-input></view><view class="input"><up-input wx:if="{{r}}" u-s="{{['prefix','suffix']}}" u-i="23c3038c-7,23c3038c-5" bind:__l="__l" bindupdateModelValue="{{q}}" u-p="{{r}}"><image style="height:40rpx;width:40rpx;margin-top:6rpx" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/3a42f202404281007454918.png" slot="prefix"></image><view slot="suffix"><up-code wx:if="{{n}}" class="r" u-r="uCodeRef" bindchange="{{m}}" u-i="23c3038c-8,23c3038c-7" bind:__l="__l" u-p="{{n}}"></up-code><view style="color:#20B128" bindtap="{{p}}">{{o}}</view></view></up-input></view></view><view class="btn"><up-button wx:if="{{t}}" u-s="{{['d']}}" bindclick="{{s}}" u-i="23c3038c-9,23c3038c-5" bind:__l="__l" u-p="{{t}}">登录</up-button></view></up-transition></block><view class="agreement"><image wx:if="{{w}}" bindtap="{{x}}" src="{{y}}"></image><image wx:else bindtap="{{z}}" src="{{A}}"></image><view> 我已同意<text>《用户协议》</text>与<text>《隐私政策》</text></view></view></view></view>
|
||||
<view><up-navbar wx:if="{{b}}" bindleftClick="{{a}}" u-i="23c3038c-0" bind:__l="__l" u-p="{{b}}"></up-navbar><view class="login-box"><image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png"></image><view class="tips">欢迎登录惠农批发</view><block wx:if="{{c}}"><up-transition wx:if="{{i}}" u-s="{{['d']}}" u-i="23c3038c-1" bind:__l="__l" u-p="{{i}}"><view class="btn"><up-button wx:if="{{f}}" u-s="{{['d']}}" bindgetphonenumber="{{e}}" u-i="23c3038c-2,23c3038c-1" bind:__l="__l" u-p="{{f}}"><up-icon wx:if="{{d}}" u-i="23c3038c-3,23c3038c-2" bind:__l="__l" u-p="{{d}}"></up-icon>微信授权手机号登录</up-button></view><view class="btn"><up-button wx:if="{{h}}" u-s="{{['d']}}" bindclick="{{g}}" u-i="23c3038c-4,23c3038c-1" bind:__l="__l" u-p="{{h}}"><text style="color:#20B128">使用短信验证登录</text></up-button></view></up-transition></block><block wx:else><up-transition wx:if="{{v}}" u-s="{{['d']}}" u-i="23c3038c-5" bind:__l="__l" u-p="{{v}}"><view class="form"><view class="input"><up-input wx:if="{{k}}" u-s="{{['prefix']}}" u-i="23c3038c-6,23c3038c-5" bind:__l="__l" bindupdateModelValue="{{j}}" u-p="{{k}}"><image style="height:40rpx;width:40rpx;margin-top:6rpx" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png" slot="prefix"></image></up-input></view><view class="input"><up-input wx:if="{{r}}" u-s="{{['prefix','suffix']}}" u-i="23c3038c-7,23c3038c-5" bind:__l="__l" bindupdateModelValue="{{q}}" u-p="{{r}}"><image style="height:40rpx;width:40rpx;margin-top:6rpx" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/3a42f202404281007454918.png" slot="prefix"></image><view slot="suffix"><up-code wx:if="{{n}}" class="r" u-r="uCodeRef" bindchange="{{m}}" u-i="23c3038c-8,23c3038c-7" bind:__l="__l" u-p="{{n}}"></up-code><view style="color:#20B128" bindtap="{{p}}">{{o}}</view></view></up-input></view></view><view class="btn"><up-button wx:if="{{t}}" u-s="{{['d']}}" bindclick="{{s}}" u-i="23c3038c-9,23c3038c-5" bind:__l="__l" u-p="{{t}}">登录</up-button></view></up-transition></block><view class="agreement"><image wx:if="{{w}}" bindtap="{{x}}" src="{{y}}"></image><image wx:else bindtap="{{z}}" src="{{A}}"></image><view> 我已同意<text>《用户协议》</text>与<text>《隐私政策》</text></view></view></view></view>
|
|
@ -28,7 +28,7 @@ const _sfc_main = {
|
|||
real_name: "",
|
||||
phone: "",
|
||||
detail: "",
|
||||
isDefault: false
|
||||
is_default: 0
|
||||
});
|
||||
const rules = common_vendor.ref({
|
||||
real_name: [{ required: true, message: "请输入姓名", trigger: ["blur"] }],
|
||||
|
@ -125,10 +125,12 @@ const _sfc_main = {
|
|||
rules: rules.value,
|
||||
labelWidth: "100"
|
||||
}),
|
||||
l: common_vendor.o(($event) => formData.value.isDefault = $event),
|
||||
l: common_vendor.o(($event) => formData.value.is_default = $event),
|
||||
m: common_vendor.p({
|
||||
activeValue: 1,
|
||||
inactiveValue: 0,
|
||||
activeColor: "#20B128",
|
||||
modelValue: formData.value.isDefault
|
||||
modelValue: formData.value.is_default
|
||||
}),
|
||||
n: common_vendor.o(submit),
|
||||
o: common_vendor.p({
|
||||
|
|
|
@ -30,8 +30,16 @@ const _sfc_main = {
|
|||
deleteInfo.value = item;
|
||||
show.value = true;
|
||||
};
|
||||
const updateDefault = (item) => {
|
||||
api_user.addressEditApi({
|
||||
...item,
|
||||
is_default: !item.is_default
|
||||
});
|
||||
};
|
||||
const deleteAddress = () => {
|
||||
console.log(deleteInfo.value);
|
||||
api_user.addressDeleteApi({
|
||||
address_id: deleteInfo.value.address_id
|
||||
});
|
||||
show.value = false;
|
||||
};
|
||||
const addressList = common_vendor.ref([]);
|
||||
|
@ -49,15 +57,19 @@ const _sfc_main = {
|
|||
return common_vendor.e({
|
||||
a: common_vendor.t(item.real_name),
|
||||
b: common_vendor.t(item.phone),
|
||||
c: common_vendor.t(item.detail)
|
||||
c: common_vendor.t(item.detail),
|
||||
d: item.is_default
|
||||
}, item.is_default ? {
|
||||
e: common_assets._imports_0$1
|
||||
} : {
|
||||
f: common_assets._imports_1$1
|
||||
}, {
|
||||
e: common_assets._imports_1$1
|
||||
}, {
|
||||
f: "5e66515e-0-" + i0,
|
||||
g: common_vendor.o(($event) => showDelete(item), index),
|
||||
h: "5e66515e-1-" + i0,
|
||||
i: common_vendor.o(($event) => navTo("/pagesOrder/addressEdit/addressEdit?mode=edit&address_id=" + item.address_id), index),
|
||||
j: index
|
||||
g: common_vendor.o(($event) => updateDefault(item), index),
|
||||
h: "5e66515e-0-" + i0,
|
||||
i: common_vendor.o(($event) => showDelete(item), index),
|
||||
j: "5e66515e-1-" + i0,
|
||||
k: common_vendor.o(($event) => navTo("/pagesOrder/addressEdit/addressEdit?mode=edit&address_id=" + item.address_id), index),
|
||||
l: index
|
||||
});
|
||||
}),
|
||||
b: common_vendor.p({
|
||||
|
|
|
@ -1 +1 @@
|
|||
<view class="list"><view wx:for="{{a}}" wx:for-item="item" wx:key="j" class="address-card"><view class="address-info"><view class="top"><view class="name">收货人:{{item.a}}</view><view class="phone">{{item.b}}</view></view><view class="bottom">{{item.c}}</view></view><view class="btn-box"><view class="left"><image wx:if="{{false}}" src="{{item.d}}"></image><image wx:else src="{{item.e}}"></image><view>设为默认</view></view><view class="right"><view class="btn" bindtap="{{item.g}}"><up-icon wx:if="{{b}}" u-i="{{item.f}}" bind:__l="__l" u-p="{{b}}"></up-icon> 删除 </view><view class="btn" bindtap="{{item.i}}"><up-icon wx:if="{{c}}" u-i="{{item.h}}" bind:__l="__l" u-p="{{c}}"></up-icon> 编辑 </view></view></view></view><view style="width:100%;height:150rpx"></view><view class="bottom-fixed"><up-button wx:if="{{e}}" u-s="{{['d']}}" bindclick="{{d}}" u-i="5e66515e-2" bind:__l="__l" u-p="{{e}}">新增地址</up-button></view><modal wx:if="{{h}}" bindclose="{{f}}" bindchange="{{g}}" u-i="5e66515e-3" bind:__l="__l" u-p="{{h}}"></modal></view>
|
||||
<view class="list"><view wx:for="{{a}}" wx:for-item="item" wx:key="l" class="address-card"><view class="address-info"><view class="top"><view class="name">收货人:{{item.a}}</view><view class="phone">{{item.b}}</view></view><view class="bottom">{{item.c}}</view></view><view class="btn-box"><view class="left" bindtap="{{item.g}}"><image wx:if="{{item.d}}" src="{{item.e}}"></image><image wx:else src="{{item.f}}"></image><view>设为默认</view></view><view class="right"><view class="btn" bindtap="{{item.i}}"><up-icon wx:if="{{b}}" u-i="{{item.h}}" bind:__l="__l" u-p="{{b}}"></up-icon> 删除 </view><view class="btn" bindtap="{{item.k}}"><up-icon wx:if="{{c}}" u-i="{{item.j}}" bind:__l="__l" u-p="{{c}}"></up-icon> 编辑 </view></view></view></view><view style="width:100%;height:150rpx"></view><view class="bottom-fixed"><up-button wx:if="{{e}}" u-s="{{['d']}}" bindclick="{{d}}" u-i="5e66515e-2" bind:__l="__l" u-p="{{e}}">新增地址</up-button></view><modal wx:if="{{h}}" bindclose="{{f}}" bindchange="{{g}}" u-i="5e66515e-3" bind:__l="__l" u-p="{{h}}"></modal></view>
|
|
@ -37,21 +37,11 @@ function baseRequest(url, method, data, {
|
|||
reslove(res.data);
|
||||
else if (res.data.code == -1) {
|
||||
if (res.data.msg == "登录超时,请重新登录") {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
icon: 'none',
|
||||
})
|
||||
uni.reLaunch({
|
||||
url: '/pages/Login/login'
|
||||
})
|
||||
}
|
||||
} else if (res.data.code == 0) {
|
||||
if (res.data.msg != '用户信息不存在') {
|
||||
uni.showToast({
|
||||
title: res.data.msg || '请检查网络',
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
reslove(res.data);
|
||||
} else if (res.data.code == 1) {
|
||||
reslove(res.data);
|
||||
|
@ -62,10 +52,6 @@ function baseRequest(url, method, data, {
|
|||
} else if (res.data.code == 501) {
|
||||
reject(res.data);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.data.msg || '请检查网络',
|
||||
icon: 'none'
|
||||
})
|
||||
reject(res.data.msg || '请检查网络');
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue