This commit is contained in:
weipengfei 2024-04-30 16:24:55 +08:00
parent 0285780294
commit 7c36041677
31 changed files with 725 additions and 315 deletions

View File

@ -20,6 +20,11 @@ export const cartListApi = (data)=>{
return request.get('/order/cart/list', data);
}
//购物车-常买记录
export const frequentlyPurchaseApi = (data)=>{
return request.get('/order/RetailOrder/frequently_purchase', data);
}
//购物车-零售购物车预检
export const checkOrderApi = (data)=>{
return request.post('/order/RetailOrder/checkOrder', data);

View File

@ -4,3 +4,13 @@ import request from '@/utils/request';
export const createOrderApi = (data)=>{
return request.post('/order/RetailOrder/createOrder', data);
}
//订单列表
export const orderListApi = (data)=>{
return request.get('/order/retailOrder/order_list', data);
}
//订单详情
export const orderDetailApi = (data)=>{
return request.get('/order/RetailOrder/detail', data);
}

View File

@ -5,6 +5,10 @@ export const userLoginApi = (data)=>{
return request.post('/login/account', data);
}
// 微信登录
export const userLoginWeixinApi = (data)=>{
return request.post('/login/mnpLogin', data);
}
// 添加地址
export const addressCreateApi = (data)=>{
@ -30,3 +34,8 @@ export const addressListsApi = (data)=>{
export const addressDetailApi = (data)=>{
return request.get('/user/address/detail', data);
}
// 自提点列表
export const merchantListApi = (data)=>{
return request.get('/merchant/merchant/lists', data);
}

View File

@ -1,7 +1,7 @@
<template>
<up-popup :show="show" closeable round="10" @close="close">
<view class="address-popup">
<view class="head-title">收货地址</view>
<view class="head-title">收货人与详细地址</view>
<view class="list-admin">
<view>常用地址</view>
<view class="admin-btn">

View File

@ -1,7 +1,9 @@
<template>
<up-popup :show="show" closeable round="10" @close="close">
<view class="good-popup">
<view class="head-title">称重商品</view>
<view class="head-title">
{{datas.is_bulk ? '称重商品' : '计件商品'}}
</view>
<view class="row">
<view>商品名称</view>
<view>{{datas.name || datas.goods_name}}</view>

View File

@ -0,0 +1,137 @@
<template>
<up-popup :show="show" closeable round="10" @close="close">
<view class="address-popup">
<view class="head-title">选择提货点</view>
<view class="list-admin">
<up-search placeholder="请输入提货点名称" @search="searchKeyword" v-model="keyword" @custom="searchKeyword"></up-search>
</view>
<scroll-view style="height: 600rpx;padding-bottom: 20rpx;" scroll-y>
<view class="row" v-for="(item,index) in list" :key="index" @click="addressType=index">
<view class="content">
<view class="top">
<view class="name">{{item.mer_name}}</view>
<u-tag v-if="item.distance" style="pointer-events: none;" :text="item.distance" type="success" plain size="mini"></u-tag>
</view>
<view class="bottom u-line-2">{{item.service_phone}}</view>
</view>
<image v-if="addressType==index" src="@/static/icon/check.png"></image>
<image v-else src="@/static/icon/n-check.png"></image>
</view>
</scroll-view>
<up-button color="#20B128" shape="circle" @click="submitAddress">确认提货点</up-button>
</view>
</up-popup>
</template>
<script setup>
import { ref } from "vue"
const addressType = ref(-1)
const props = defineProps({
show: {
type: Boolean,
default: false
},
list: {
type: Array,
default: ()=>[]
}
})
const emit = defineEmits(['close', 'change', 'search']);
const close = () => {
emit('close');
}
const submitAddress = () => {
emit('change', props.list[addressType.value]);
}
const keyword = ref('')
const searchKeyword = ()=>{
emit('search', keyword.value);
}
const navTo = (url)=>{
uni.navigateTo({
url: url
})
}
</script>
<style scoped lang="scss">
.address-popup {
padding: 30rpx;
.head-title {
font-weight: bold;
text-align: center;
margin-bottom: 20rpx;
}
.list-admin {
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
.admin-btn {
display: flex;
color: #20B128;
.btn {
margin-left: 20rpx;
display: flex;
align-items: center;
&:active {
color: rgba(#20B128, 0.8);
transition: background-color 0.5s;
animation: disappear 0.5s 0.5s forwards;
}
}
}
}
.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>

View File

@ -1,12 +1,12 @@
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 = 'https://ceshi-erp.lihaink.cn';break;
default: BASE_URL = 'http://192.168.1.21:8787';
default: BASE_URL = 'http://192.168.1.22:8787';
}
let HTTP_REQUEST_URL

View File

@ -50,11 +50,17 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wxce2948c50d808b66",
"appid" : "wxdee751952c8c2027",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
"usingComponents" : true,
"permission" : {
"scope.userLocation" : {
"desc" : "你的位置信息将用于查找最近的提货点"
}
},
"requiredPrivateInfos" : [ "chooseLocation", "getLocation" ]
},
"mp-alipay" : {
"usingComponents" : true

View File

@ -17,12 +17,12 @@
<view class="page-box1">
<view class="total">
<view>共计<text style="color: #20B128;">{{cartList.length}}</text></view>
<view v-if="true">管理</view>
<view v-else>完成</view>
<view v-if="!isAdmin" @click="isAdmin=true;">管理</view>
<view v-else @click="isAdmin=false;">完成</view>
</view>
<view v-if="true" class="list" style="margin-top: 80rpx;">
<view v-if="cartList.length>0" class="list" style="margin-top: 80rpx;">
<view class="shop-item" v-for="(item, index) in cartList" :key="index" @click="openGoodPopup(item)">
<view class="shop-check">
<view class="shop-check" @click.stop="checkItem(item, !item.check)">
<image v-if="!item.check" src="@/static/icon/n-check.png"></image>
<image v-else src="@/static/icon/check.png"></image>
</view>
@ -33,7 +33,7 @@
<view class="tip u-line-1">{{item.unit_name}}</view>
</view>
<view class="price-btn">
<view class="price">{{item.goods_total_price}}</view>
<view class="price">{{item.sell}}</view>
<view class="btn">
<view class="num">{{item.cart_num}}</view>
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
@ -55,15 +55,15 @@
<scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="page-box1">
<view v-if="true" class="list">
<view class="shop-item" v-for="(item, index) in 20" :key="index">
<image class="shop-img" src="https://cdn.uviewui.com/uview/album/1.jpg"></image>
<view class="shop-item" v-for="(item, index) in frequentlyList" :key="index" @click="openGoodPopup(item)">
<image class="shop-img" :src="item.imgs"></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 class="name u-line-2">{{item.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.sell}}</view>
<view class="btn">
<up-button size="small" plain color="#20b128" shape="circle">加入购物车</up-button>
</view>
@ -83,26 +83,29 @@
</swiper>
<up-transition :show="tabsActive==0">
<view class="cart-btn">
<view class="cart-check">
<image v-if="false" src="@/static/icon/n-check.png"></image>
<view class="fiexd-btn-box cart-btn">
<view class="cart-check" @click="changeAll(checkAll===cartInfo.count)">
<image v-if="checkAll!=cartInfo.count" src="@/static/icon/n-check.png"></image>
<image v-else src="@/static/icon/check.png"></image>
<text style="font-size: 24rpx;">全选</text>
<text style="font-size: 24rpx;" v-if="checkAll">({{checkAll}})</text>
</view>
<view v-if="true" class="btn-boxs">
<view v-if="!isAdmin" 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;">{{c_price(cartInfo.total_price, 0)}}</text>
<text style="font-size: 24rpx;">.{{c_price(cartInfo.total_price, 1)}}</text>
<text style="font-size: 34rpx;">{{c_price0}}</text>
<text style="font-size: 24rpx;">.{{c_price1}}</text>
</view>
</view>
<up-button color="#20b128" shape="circle" :disabled="false" @click="settleAccounts">去结算<text>(2)</text></up-button>
<view style="width: 200rpx;">
<up-button color="#20b128" shape="circle" :disabled="!checkAll" @click="settleAccounts">去结算<text v-if="checkAll">({{checkAll}})</text></up-button>
</view>
</view>
<view v-else class="btn-boxs">
<!-- <view style="width: 100px;margin-right: 20rpx;"><up-button size="small" plain color="#989898" shape="circle">移入收藏夹</up-button></view> -->
<view style="width: 80px;"><up-button size="small" plain color="#989898" shape="circle">删除</up-button></view>
<view style="width: 100px;"><up-button @click="deleteCartList()" size="small" plain color="#989898" shape="circle">删除</up-button></view>
</view>
</view>
</up-transition>
@ -112,9 +115,12 @@
<script setup>
import { onShow } from "@dcloudio/uni-app"
import { ref } from 'vue';
import { cartListApi, cartChangeApi } from "@/api/cart.js"
import { computed, ref, watch } from 'vue';
import { cartListApi, cartChangeApi, cartCreateApi, cartDeleteApi, frequentlyPurchaseApi } from "@/api/cart.js"
import goodPopup from "@/components/goodPopup.vue"
import useCartStore from "@/store/cart.js"
const cartStore = useCartStore();
//
const list = ref(['购物车', '常买']);
@ -133,62 +139,120 @@
//
const settleAccounts = ()=>{
let list = [];
cartList.value.forEach(item=>{
if(item.check) list.push(item.cart_id);
})
cartStore.setCartList(list);
uni.navigateTo({
url: '/pagesOrder/settle/settle'
})
}
//
const deleteCartList = ()=>{
let list = [];
cartList.value.forEach(item=>{
if(item.check) list.push(item.cart_id);
})
cartDeleteApi({
cart_id: list
}).then(()=>{
getcartList(false);
})
}
//
const addCart = (id, cart_num) => { //
cartChangeApi({
cart_num: cart_num,
is_new: 0, // 01
cart_id: id
cartCreateApi({
cart_num: +cart_num,
goods_id: id
}).then(res => {
getcartList();
})
}
const removeCart = (id) => {
let num = cartList.get(id) || 0;
if (num == 0) return;
cartChangeApi({
cart_id: id,
cart_num: num--
}).then(res => {
const isAdmin = ref(false); //
})
}
//
const showGoodPopup = ref(false);
const goodRef = ref(null);
const goodData = ref({});
const openGoodPopup = (item) => { // /
goodData.value = item;
goodRef.value.setData(item);
goodData.value = JSON.parse(JSON.stringify(item));
goodRef.value.setData(goodData.value);
showGoodPopup.value = true;
};
const changeGood = (data)=>{ //
showGoodPopup.value = false;
addCart(data.cart_id, data.cart_num);
addCart(data.goods_id||data.id, data.cart_num);
}
const cartList = ref([]);
const cartInfo = ref({});
const getcartList = ()=>{
const getcartList = (check=true)=>{
cartListApi().then(res=>{
res.data.lists = res.data.lists.map(item=>{
item.check = true;
return item;
})
if(check) {
res.data.lists = res.data.lists.map(item=>{
item.check = true;
return item;
})
checkAll.value = res.data?.count || 0
}else {
checkAll.value = 0
}
cartList.value = res.data.lists;
cartInfo.value = res.data?.extend?.total_price || '0.00';
cartInfo.value = {
total_price: res.data?.extend.total_price || '0.00',
count: res.data?.count || 0
}
})
}
const c_price = (price=0, index=0)=>{
price = price + '';
return price.split('.')[index] || 0;
const c_price0 = computed(()=>{
let price = cartInfo.value.total_price + '';
return price.split('.')[0] || '0';
})
const c_price1 = computed(()=>{
let price = cartInfo.value.total_price + '';
return price.split('.')[1] || '00';
})
//
let checkAll = ref(0)
const checkItem = (item, type)=>{
item.check = type;
let price = Number(cartInfo.value.total_price);
if(type){
price += item.sell * item.cart_num;
checkAll.value++;
}else {
price -= item.sell * item.cart_num;
checkAll.value--;
}
cartInfo.value.total_price = price.toFixed(2);
}
const changeAll = (flag=false)=>{
cartList.value.forEach(item=>{
item.check = !flag;
})
if(!flag) checkAll.value = cartInfo.value.count;
else checkAll.value = 0;
}
//
const frequentlyList = ref([]);
const where = ref({
page_no: 1,
page_size: 25
})
const getFrequentlyPurchase = ()=>{
frequentlyPurchaseApi({
...where.value
}).then(res=>{
frequentlyList.value = res.data;
})
}
getFrequentlyPurchase();
onShow(()=>{
getcartList();
@ -210,9 +274,9 @@
.swiper-box {
flex: 1;
height: calc(100vh - var(--window-top) - var(--window-bottom));
height: calc(100vh - var(--window-top));
/* #ifdef H5 */
height: calc(100vh - 96px);
height: calc(100vh - 44px);
/* #endif */
width: 100%;
@ -314,18 +378,6 @@
}
.cart-btn {
width: 100%;
height: 50px;
box-sizing: border-box;
background-color: pink;
background-color: #fff;
position: fixed;
left: 0;
bottom: var(--window-bottom);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
.cart-check {
display: flex;

View File

@ -14,8 +14,8 @@
<block v-if="showWeixin">
<up-transition :show="showWeixin">
<view class="btn">
<up-button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" color="#20B128" size="large"><up-icon
name="weixin-fill" color="#fff" size="28"></up-icon></up-button>
<up-button open-type="getPhoneNumber" @click="weixinLogin" color="#20B128" size="large"><up-icon
name="weixin-fill" color="#fff" size="28"></up-icon></up-button>
</view>
<view class="btn">
<up-button color="#ECFFEE" @click="showWeixin=false" size="large"><text style="color: #20B128;">使用短信验证登录</text></up-button>
@ -66,7 +66,7 @@
<script setup>
import { onBackPress } from "@dcloudio/uni-app"
import { ref } from "vue"
import { userLoginApi } from "@/api/user.js";
import { userLoginApi, userLoginWeixinApi } from "@/api/user.js";
import useUserStore from "@/store/user.js"
const userStore = useUserStore(); //使pinia
@ -80,7 +80,15 @@
uni.login({
provider: 'weixin',
success: (res) => {
console.log(res);
userLoginWeixinApi({
code: res.code
}).then(res=>{
console.log(res);
})
},
fail: (err) => {
console.log(err);
uni.$u.toast('登录失败');
}
})
}
@ -159,7 +167,7 @@
.login-box {
width: 700rpx;
height: 88vh;
height: 80vh;
margin: 0 auto;
box-sizing: border-box;
display: flex;

View File

@ -99,6 +99,7 @@
import cancelDict from "@/dict/cancelDict.js";
import addressPopup from "@/components/addressPopup.vue";
import modal from "@/components/modal.vue";
import { orderDetailApi } from "@/api/order.js"
const showCancel = ref(false);
const showAddress = ref(false);
@ -119,6 +120,13 @@
console.log(e);
}
const datas = ref({})
const getDetails = ()=>{
orderDetailApi().then(res=>{
})
}
onLoad((option) => {
uni.setNavigationBarTitle({
title: option.type == 1 ? '等待付款' : '订单详情'

View File

@ -1,24 +1,16 @@
<template>
<view class="shop-item">
<view class="item-title" @click="navTo">
<view>wxo12335656455532232666</view>
<view>{{datas.number}}</view>
<view>待付款</view>
</view>
<view class="item-body" @click="navTo">
<image class="image" src="../../../static/logo.png"></image>
<view class="body-content">
<view>
<view class="title">
<view>黄牛肉20kg</view>
<view>¥10.00</view>
</view>
<view class="tips">
<view>我不吃牛肉</view>
<view>x5</view>
</view>
<view v-for="(item,index) in datas.goods_list" :key="index">
<image class="image" :src="item.imgs"></image>
</view>
<view class="all">共5件商品, 总金额 <text>¥20.30</text> </view>
</view>
<view class="all">共5件商品, 总金额 <text>¥{{datas.total}}</text> </view>
</view>
<view v-if="type==1" class="item-btn">
<view style="width: 80px;"><up-button size="small" plain color="#989898" shape="circle">取消订单</up-button></view>
@ -44,13 +36,19 @@ const props = defineProps({
type:{
type: Number,
default: 0
},
datas:{
type: Object,
default: ()=>{}
}
})
const navTo = ()=>{
uni.navigateTo({
url: '/pagesOrder/detail/detail?type=1'
url: `/pagesOrder/detail/detail?type=0&id=${props.datas.id}`
})
}
</script>
@ -58,7 +56,6 @@ const navTo = ()=>{
.shop-item{
width: 710rpx;
height: 340rpx;
margin-bottom: 20rpx;
background-color: #fff;
border-radius: 14rpx;
@ -69,21 +66,17 @@ const navTo = ()=>{
justify-content: space-between;
}
.item-body{
display: flex;
justify-content: space-between;
margin: 20rpx 0;
.image{
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.body-content{
width: 490rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
color: #989898;
.image{
width: 120rpx;
height: 120rpx;
margin-right: 20rpx;
}
.title{
display: flex;
justify-content: space-between;
@ -96,12 +89,13 @@ const navTo = ()=>{
font-size: 24rpx;
margin-top: 10rpx;
}
.all{
align-self: flex-end;
font-size: 26rpx;
text{
color: #F55726;
}
}
.all{
text-align: right;
font-size: 26rpx;
text{
color: #F55726;
}
}
}

View File

@ -8,12 +8,11 @@
</up-sticky>
<swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish">
<!-- 全部 -->
<swiper-item class="swiper-item">
<swiper-item class="swiper-item" v-for="(list, k) in orderList" :key="k">
<scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="page-box">
<view v-if="true" class="list">
<good v-for="(item, index) in 10" :key="index" :type="0"></good>
<good v-for="(item, index) in list" :datas="item" :key="index" :type="k"></good>
</view>
<view v-else style="padding-top: 100rpx;">
<up-empty text="订单空空如也"
@ -24,54 +23,6 @@
</view>
</scroll-view>
</swiper-item>
<!-- 待付款 -->
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="page-box">
<view v-if="true" class="list">
<good v-for="(item, index) in 10" :key="index" :type="1"></good>
</view>
<view v-else style="padding-top: 100rpx;">
<up-empty text="订单空空如也"
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png">
</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-box">
<view v-if="true" class="list">
<good v-for="(item, index) in 10" :key="index" :type="2"></good>
</view>
<view v-else style="padding-top: 100rpx;">
<up-empty text="订单空空如也"
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png">
</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-box">
<view v-if="true" class="list">
<good v-for="(item, index) in 10" :key="index" :type="3"></good>
</view>
<view v-else style="padding-top: 100rpx;">
<up-empty text="订单空空如也"
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png">
</up-empty>
</view>
<view style="width: 100%;height: 200rpx;"></view>
</view>
</scroll-view>
</swiper-item> -->
</swiper>
</view>
@ -81,6 +32,7 @@
import { onLoad } from "@dcloudio/uni-app"
import { ref } from 'vue';
import good from "./component/good.vue";
import { orderListApi } from "@/api/order.js";
const tabsActive = ref(0)
const changeTab = ({index}) => {
@ -100,11 +52,30 @@
tabsActive.value = current;
}
//
const where = ref({
page_no: 1,
page_size: 25
})
const orderList= ref([
[],
[],
[],
])
const getOrderList = (type=0)=>{
orderListApi({
...where.value
}).then(res=>{
orderList.value[type] = res.data.lists;
})
}
onLoad((options)=>{
if(options.type){
tabsActive.value = +options.type;
swiperCurrent.value = +options.type;
}
getOrderList();
})
</script>

View File

@ -1,9 +1,30 @@
<template>
<view class="">
<view class="m-card row">
<!-- <view class="m-card row">
<up-cell-group>
<up-cell title="请添加自提点" :isLink="true" :border="false"></up-cell>
<up-cell title="请添加自提点" :isLink="true" :border="false" @click="shopListShow=true"></up-cell>
</up-cell-group>
</view> -->
<view class="m-card m-address">
<view class="address-info">
<view class="top" style="align-items: flex-start;">
<view style="color: #333;display: flex;align-items: center;">
<up-icon name="map"></up-icon>
<text style="margin: 0 10rpx;">自提点</text>
</view>
<view v-if="shopInfo.mer_id">
<view>{{shopInfo.mer_name}}</view>
<view>
<text>{{shopInfo.service_phone}}</text>
<text style="color: #20b128;margin-left: 10rpx;font-size: 22rpx;">{{shopInfo.distance}}</text>
</view>
</view>
</view>
</view>
<view class="address-btn">
<view style="width: 80px;"><up-button @click="shopListShow=true" size="small" shape="circle" color="#f6f6f6"
:customStyle="{color:'#666666'}">修改</up-button></view>
</view>
</view>
<view v-if="!isAddress" class="m-card row">
<up-cell-group>
@ -13,7 +34,7 @@
<view v-else class="m-card m-address">
<view class="address-info">
<view class="top">
<up-icon name="map"></up-icon>
<up-icon name="account"></up-icon>
<view class="t-name">{{addressInfo.real_name}}</view>
<view>{{addressInfo.phone}}</view>
</view>
@ -83,8 +104,10 @@
<view class="all">
<text style="color: #000;">合计: </text>
<text></text>
<text style="font-size: 32rpx;font-weight: bold;">{{c_price(orderInfo.total, 0)}}</text>
<text>.{{c_price(orderInfo.total, 1)}}</text>
<block v-if="orderInfo.total">
<text style="font-size: 32rpx;font-weight: bold;">{{c_price(orderInfo.total, 0)}}</text>
<text>.{{c_price(orderInfo.total, 1)}}</text>
</block>
</view>
</view>
<view style="width: 200rpx;">
@ -93,6 +116,7 @@
</view>
<addressPopup v-if="addressList.length>0" :show="showAddress" :list="addressList" @close="showAddress=false" @change="changeAddress" />
<shopListPopupVue v-if="merchantList.length>0" :show="shopListShow" :list="merchantList" @close="shopListShow=false" @change="changeShop" @search="searchShop" />
<modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow"
@close="addAddress" @change="goPay" />
</view>
@ -102,10 +126,11 @@
import { onLoad } from "@dcloudio/uni-app"
import { nextTick, ref } from "vue"
import addressPopup from "@/components/addressPopup.vue";
import shopListPopupVue from "@/components/shopListPopup.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 { addressListsApi, merchantListApi } from "@/api/user.js";
import { createOrderApi } from "@/api/order.js";
const cartStore = useCartStore();
@ -145,6 +170,53 @@
console.log(e);
}
//
const shopListShow = ref(false);
const merchantList = ref([]);
const myAddressInfo = ref({
long: "",
lat: ""
})
const shopInfo = ref({
mer_id: ''
});
const getMerchantList = (mer_name=null)=>{
merchantListApi({
...myAddressInfo.value,
mer_name: mer_name ? mer_name : ''
}).then(res=>{
merchantList.value = res.data.lists;
if(mer_name===null && myAddressInfo.value.long && merchantList.value.length>0 && !shopInfo.value.mer_id) {
shopInfo.value = merchantList.value[0];
}
})
}
getMerchantList('');
//
const LoadAddress = ()=>{
uni.getLocation({
success: (res) => {
},
fail: (err) => {
uni.$u.toast('定位失败, 请手动选择提货点!')
},
complete: (res) => {
console.log("===", res);
myAddressInfo.value.long = res.longitude || "";
myAddressInfo.value.lat = res.latitude || "";
getMerchantList();
}
})
}
LoadAddress();
const changeShop = (e)=>{
shopInfo.value = e;
shopListShow.value = false;
}
const searchShop = (e)=>{
getMerchantList(e)
}
//
const addAddress = () => {
toastAddressShow.value = false;
@ -178,7 +250,8 @@
const createOrder = ()=>{
createOrderApi({
cart_id: cartStore.cartList,
address_id: 1,
address_id: addressInfo.value.address_id,
mer_id: shopInfo.value.mer_id,
pay_type: 3
}).then(res=>{
uni.showModal({
@ -197,7 +270,7 @@
const c_price = (price, index=0)=>{
price = price + '';
return price.split('.')[index];
return price.split('.')[index] || (index ? '00' : '0');
}
onLoad(options=>{

View File

@ -23,5 +23,14 @@
"navigationBarBackgroundColor": "#fff",
"backgroundColor": "#fff"
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于查找最近的提货点"
}
},
"requiredPrivateInfos": [
"chooseLocation",
"getLocation"
],
"usingComponents": {}
}

View File

@ -1 +1 @@
<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>
<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>

View File

@ -2,6 +2,7 @@
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.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");
@ -25,6 +26,7 @@ const goodPopup = () => "../../components/goodPopup.js";
const _sfc_main = {
__name: "cart",
setup(__props) {
const cartStore = store_cart.useCartStore();
const list = common_vendor.ref(["购物车", "常买"]);
const tabsActive = common_vendor.ref(0);
const changeTab = (e) => {
@ -37,49 +39,113 @@ const _sfc_main = {
tabsActive.value = current;
};
const settleAccounts = () => {
let list2 = [];
cartList.value.forEach((item) => {
if (item.check)
list2.push(item.cart_id);
});
cartStore.setCartList(list2);
common_vendor.index.navigateTo({
url: "/pagesOrder/settle/settle"
});
};
const deleteCartList = () => {
let list2 = [];
cartList.value.forEach((item) => {
if (item.check)
list2.push(item.cart_id);
});
api_cart.cartDeleteApi({
cart_id: list2
}).then(() => {
getcartList(false);
});
};
const addCart = (id, cart_num) => {
api_cart.cartChangeApi({
cart_num,
is_new: 0,
// 是否直接购买0否1是
cart_id: id
api_cart.cartCreateApi({
cart_num: +cart_num,
goods_id: id
}).then((res) => {
getcartList();
});
};
const isAdmin = common_vendor.ref(false);
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);
goodData.value = JSON.parse(JSON.stringify(item));
goodRef.value.setData(goodData.value);
showGoodPopup.value = true;
};
const changeGood = (data) => {
showGoodPopup.value = false;
addCart(data.cart_id, data.cart_num);
addCart(data.goods_id || data.id, data.cart_num);
};
const cartList = common_vendor.ref([]);
const cartInfo = common_vendor.ref({});
const getcartList = () => {
const getcartList = (check = true) => {
api_cart.cartListApi().then((res) => {
var _a, _b;
res.data.lists = res.data.lists.map((item) => {
item.check = true;
return item;
});
var _a, _b, _c;
if (check) {
res.data.lists = res.data.lists.map((item) => {
item.check = true;
return item;
});
checkAll.value = ((_a = res.data) == null ? void 0 : _a.count) || 0;
} else {
checkAll.value = 0;
}
cartList.value = res.data.lists;
cartInfo.value = ((_b = (_a = res.data) == null ? void 0 : _a.extend) == null ? void 0 : _b.total_price) || "0.00";
cartInfo.value = {
total_price: ((_b = res.data) == null ? void 0 : _b.extend.total_price) || "0.00",
count: ((_c = res.data) == null ? void 0 : _c.count) || 0
};
});
};
const c_price = (price = 0, index = 0) => {
price = price + "";
return price.split(".")[index] || 0;
const c_price0 = common_vendor.computed(() => {
let price = cartInfo.value.total_price + "";
return price.split(".")[0] || "0";
});
const c_price1 = common_vendor.computed(() => {
let price = cartInfo.value.total_price + "";
return price.split(".")[1] || "00";
});
let checkAll = common_vendor.ref(0);
const checkItem = (item, type) => {
item.check = type;
let price = Number(cartInfo.value.total_price);
if (type) {
price += item.sell * item.cart_num;
checkAll.value++;
} else {
price -= item.sell * item.cart_num;
checkAll.value--;
}
cartInfo.value.total_price = price.toFixed(2);
};
const changeAll = (flag = false) => {
cartList.value.forEach((item) => {
item.check = !flag;
});
if (!flag)
checkAll.value = cartInfo.value.count;
else
checkAll.value = 0;
};
const frequentlyList = common_vendor.ref([]);
const where = common_vendor.ref({
page_no: 1,
page_size: 25
});
const getFrequentlyPurchase = () => {
api_cart.frequentlyPurchaseApi({
...where.value
}).then((res) => {
frequentlyList.value = res.data;
});
};
getFrequentlyPurchase();
common_vendor.onShow(() => {
getcartList();
});
@ -97,9 +163,20 @@ const _sfc_main = {
placeholder: true,
autoBack: true
}),
c: common_vendor.t(cartList.value.length)
}, {}, {
d: common_vendor.f(cartList.value, (item, index, i0) => {
c: common_vendor.t(cartList.value.length),
d: !isAdmin.value
}, !isAdmin.value ? {
e: common_vendor.o(($event) => {
isAdmin.value = true;
})
} : {
f: common_vendor.o(($event) => {
isAdmin.value = false;
})
}, {
g: cartList.value.length > 0
}, cartList.value.length > 0 ? {
h: common_vendor.f(cartList.value, (item, index, i0) => {
return common_vendor.e({
a: !item.check
}, !item.check ? {
@ -107,58 +184,91 @@ const _sfc_main = {
} : {
c: common_assets._imports_0$1
}, {
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.o(($event) => checkItem(item, !item.check), index),
e: item.imgs,
f: common_vendor.t(item.goods_name),
g: common_vendor.t(item.unit_name),
h: common_vendor.t(item.sell),
i: common_vendor.t(item.cart_num),
j: "da603134-1-" + i0,
k: index,
l: common_vendor.o(($event) => openGoodPopup(item), index)
});
}),
e: common_vendor.p({
i: common_vendor.p({
name: "plus-circle-fill",
size: "20",
color: "#20b128"
})
} : {
j: common_vendor.p({
text: "购物车空空如也",
icon: "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png"
})
}, {
g: common_vendor.f(20, (item, index, i0) => {
k: common_vendor.f(frequentlyList.value, (item, index, i0) => {
return {
a: "da603134-3-" + i0,
b: index
a: item.imgs,
b: common_vendor.t(item.name),
c: common_vendor.t(item.unit_name),
d: common_vendor.t(item.sell),
e: "da603134-3-" + i0,
f: index,
g: common_vendor.o(($event) => openGoodPopup(item), index)
};
}),
h: common_vendor.p({
l: common_vendor.p({
size: "small",
plain: true,
color: "#20b128",
shape: "circle"
})
}, {
j: swiperCurrent.value,
k: common_vendor.o(animationfinish)
n: swiperCurrent.value,
o: common_vendor.o(animationfinish),
p: common_vendor.unref(checkAll) != cartInfo.value.count
}, common_vendor.unref(checkAll) != cartInfo.value.count ? {
q: common_assets._imports_1$1
} : {
r: common_assets._imports_0$1
}, {
m: common_assets._imports_0$1
}, {
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({
s: common_vendor.unref(checkAll)
}, common_vendor.unref(checkAll) ? {
t: common_vendor.t(common_vendor.unref(checkAll))
} : {}, {
v: common_vendor.o(($event) => changeAll(common_vendor.unref(checkAll) === cartInfo.value.count)),
w: !isAdmin.value
}, !isAdmin.value ? common_vendor.e({
x: common_vendor.t(c_price0.value),
y: common_vendor.t(c_price1.value),
z: common_vendor.unref(checkAll)
}, common_vendor.unref(checkAll) ? {
A: common_vendor.t(common_vendor.unref(checkAll))
} : {}, {
B: common_vendor.o(settleAccounts),
C: common_vendor.p({
color: "#20b128",
shape: "circle",
disabled: false
disabled: !common_vendor.unref(checkAll)
})
}) : {
D: common_vendor.o(($event) => deleteCartList()),
E: common_vendor.p({
size: "small",
plain: true,
color: "#989898",
shape: "circle"
})
}, {
s: common_vendor.p({
F: common_vendor.p({
show: tabsActive.value == 0
}),
t: common_vendor.sr(goodRef, "da603134-8", {
G: 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({
H: common_vendor.o(($event) => showGoodPopup.value = false),
I: common_vendor.o(changeGood),
J: common_vendor.p({
show: showGoodPopup.value
})
});

View File

@ -1 +1 @@
<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>
<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="{{n}}" bindanimationfinish="{{o}}"><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="{{d}}" bindtap="{{e}}">管理</view><view wx:else bindtap="{{f}}">完成</view></view><view wx:if="{{g}}" class="list" style="margin-top:80rpx"><view wx:for="{{h}}" wx:for-item="item" wx:key="k" class="shop-item" bindtap="{{item.l}}"><view class="shop-check" catchtap="{{item.d}}"><image wx:if="{{item.a}}" src="{{item.b}}"></image><image wx:else src="{{item.c}}"></image></view><image class="shop-img" src="{{item.e}}"></image><view class="shop-content"><view class="title"><view class="name u-line-2">{{item.f}}</view><view class="tip u-line-1">{{item.g}}</view></view><view class="price-btn"><view class="price">¥{{item.h}}</view><view class="btn"><view class="num">{{item.i}}</view><u--icon wx:if="{{i}}" u-i="{{item.j}}" bind:__l="__l" u-p="{{i}}"></u--icon></view></view></view></view></view><view wx:else style="margin-top:100rpx"><up-empty wx:if="{{j}}" u-i="da603134-2" bind:__l="__l" u-p="{{j}}"></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="{{k}}" wx:for-item="item" wx:key="f" class="shop-item" bindtap="{{item.g}}"><image class="shop-img" src="{{item.a}}"></image><view class="shop-content" style="width:490rpx"><view class="title"><view class="name u-line-2">{{item.b}}</view><view class="tip u-line-1">{{item.c}}</view></view><view class="price-btn"><view class="price">¥{{item.d}}</view><view class="btn"><up-button wx:if="{{l}}" u-s="{{['d']}}" u-i="{{item.e}}" bind:__l="__l" u-p="{{l}}">加入购物车</up-button></view></view></view></view></view><view wx:else style="margin-top:100rpx"><up-empty wx:if="{{m}}" u-i="da603134-4" bind:__l="__l" u-p="{{m}}"></up-empty></view><view style="width:100%;height:200rpx"></view></view></scroll-view></swiper-item></swiper><up-transition wx:if="{{F}}" u-s="{{['d']}}" u-i="da603134-5" bind:__l="__l" u-p="{{F}}"><view class="fiexd-btn-box cart-btn"><view class="cart-check" bindtap="{{v}}"><image wx:if="{{p}}" src="{{q}}"></image><image wx:else src="{{r}}"></image><text style="font-size:24rpx">全选</text><text wx:if="{{s}}" style="font-size:24rpx">({{t}})</text></view><view wx:if="{{w}}" 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">{{x}}</text><text style="font-size:24rpx">.{{y}}</text></view></view><view style="width:200rpx"><up-button wx:if="{{C}}" u-s="{{['d']}}" bindclick="{{B}}" u-i="da603134-6,da603134-5" bind:__l="__l" u-p="{{C}}">去结算<text wx:if="{{z}}">({{A}})</text></up-button></view></view><view wx:else class="btn-boxs"><view style="width:100px"><up-button wx:if="{{E}}" u-s="{{['d']}}" bindclick="{{D}}" u-i="da603134-7,da603134-5" bind:__l="__l" u-p="{{E}}">删除</up-button></view></view></view></up-transition><good-popup wx:if="{{J}}" class="r" u-r="goodRef" bindclose="{{H}}" bindchange="{{I}}" u-i="da603134-8" bind:__l="__l" u-p="{{J}}"/></view>

View File

@ -34,7 +34,7 @@
}
.swiper-box {
flex: 1;
height: calc(100vh - var(--window-top) - var(--window-bottom));
height: calc(100vh - var(--window-top));
width: 100%;
}
.swiper-box .swiper-item {
@ -116,20 +116,6 @@
width: 60rpx;
text-align: center;
}
.cart-btn {
width: 100%;
height: 50px;
box-sizing: border-box;
background-color: pink;
background-color: #fff;
position: fixed;
left: 0;
bottom: var(--window-bottom);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
}
.cart-btn .cart-check {
display: flex;
align-items: center;

View File

@ -29,8 +29,23 @@ const _sfc_main = {
store_user.useUserStore();
const showWeixin = common_vendor.ref(true);
const isAgree = common_vendor.ref(false);
const getPhoneNumber = (e) => {
console.log(e);
const weixinLogin = () => {
if (!isAgree.value)
return common_vendor.index.$u.toast("请先阅读并同意协议");
common_vendor.index.login({
provider: "weixin",
success: (res) => {
api_user.userLoginWeixinApi({
code: res.code
}).then((res2) => {
console.log(res2);
});
},
fail: (err) => {
console.log(err);
common_vendor.index.$u.toast("登录失败");
}
});
};
const loginForm = common_vendor.ref({
phone: "15366662222",
@ -102,7 +117,7 @@ const _sfc_main = {
color: "#fff",
size: "28"
}),
e: common_vendor.o(getPhoneNumber),
e: common_vendor.o(weixinLogin),
f: common_vendor.p({
["open-type"]: "getPhoneNumber",
color: "#20B128",

View File

@ -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']}}" bindclick="{{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 File

@ -28,7 +28,7 @@ page {
}
.login-box {
width: 700rpx;
height: 88vh;
height: 80vh;
margin: 0 auto;
box-sizing: border-box;
display: flex;

View File

@ -2,6 +2,9 @@
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const dict_cancelDict = require("../../dict/cancelDict.js");
require("../../utils/request.js");
require("../../config/app.js");
require("../../store/user.js");
if (!Array) {
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
@ -36,6 +39,7 @@ const _sfc_main = {
showAddress.value = false;
console.log(e);
};
common_vendor.ref({});
common_vendor.onLoad((option) => {
common_vendor.index.setNavigationBarTitle({
title: option.type == 1 ? "等待付款" : "订单详情"

View File

@ -16,35 +16,34 @@ const _sfc_main = {
type: {
type: Number,
default: 0
},
datas: {
type: Object,
default: () => {
}
}
},
setup(__props) {
const props = __props;
const navTo = () => {
common_vendor.index.navigateTo({
url: "/pagesOrder/detail/detail?type=1"
url: `/pagesOrder/detail/detail?type=0&id=${props.datas.id}`
});
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.o(navTo),
a: common_vendor.t(__props.datas.number),
b: common_vendor.o(navTo),
c: __props.type == 1
}, __props.type == 1 ? {
d: common_vendor.p({
size: "small",
plain: true,
color: "#989898",
shape: "circle"
c: common_vendor.f(__props.datas.goods_list, (item, index, i0) => {
return {
a: item.imgs,
b: index
};
}),
e: common_vendor.p({
size: "small",
plain: true,
color: "#20B128",
shape: "circle"
})
} : {}, {
f: __props.type == 2 || __props.type == 0
}, __props.type == 2 || __props.type == 0 ? {
d: common_vendor.t(__props.datas.total),
e: common_vendor.o(navTo),
f: __props.type == 1
}, __props.type == 1 ? {
g: common_vendor.p({
size: "small",
plain: true,
@ -56,17 +55,32 @@ const _sfc_main = {
plain: true,
color: "#20B128",
shape: "circle"
})
} : {}, {
i: __props.type == 2 || __props.type == 0
}, __props.type == 2 || __props.type == 0 ? {
j: common_vendor.p({
size: "small",
plain: true,
color: "#989898",
shape: "circle"
}),
i: common_vendor.p({
k: common_vendor.p({
size: "small",
plain: true,
color: "#20B128",
shape: "circle"
}),
l: common_vendor.p({
size: "small",
plain: true,
color: "#20B128",
shape: "circle"
})
} : {}, {
j: __props.type == 3
m: __props.type == 3
}, __props.type == 3 ? {
k: common_vendor.p({
n: common_vendor.p({
name: "arrow-right"
})
} : {});

View File

@ -1 +1 @@
<view class="shop-item"><view class="item-title" bindtap="{{a}}"><view>wxo12335656455532232666</view><view>待付款</view></view><view class="item-body" bindtap="{{b}}"><image class="image" src="/static/logo.png"></image><view class="body-content"><view><view class="title"><view>黄牛肉20kg</view><view>¥10.00</view></view><view class="tips"><view>我不吃牛肉</view><view>x5</view></view></view><view class="all">共5件商品, 总金额 <text>¥20.30</text></view></view></view><view wx:if="{{c}}" class="item-btn"><view style="width:80px"><up-button wx:if="{{d}}" u-s="{{['d']}}" u-i="e1c5d592-0" bind:__l="__l" u-p="{{d}}">取消订单</up-button></view><view style="width:80px"><up-button wx:if="{{e}}" u-s="{{['d']}}" u-i="e1c5d592-1" bind:__l="__l" u-p="{{e}}">立即支付</up-button></view></view><view wx:if="{{f}}" class="item-btn"><view style="width:80px"><up-button wx:if="{{g}}" u-s="{{['d']}}" u-i="e1c5d592-2" bind:__l="__l" u-p="{{g}}">申请售后</up-button></view><view style="width:80px"><up-button wx:if="{{h}}" u-s="{{['d']}}" u-i="e1c5d592-3" bind:__l="__l" u-p="{{h}}">确认收货</up-button></view><view style="width:80px"><up-button wx:if="{{i}}" u-s="{{['d']}}" u-i="e1c5d592-4" bind:__l="__l" u-p="{{i}}">再次购买</up-button></view></view><view wx:if="{{j}}" class="item-close"><view class="title"><view class="type">退款申请中</view><view>等待商家处理</view></view><up-icon wx:if="{{k}}" u-i="e1c5d592-5" bind:__l="__l" u-p="{{k}}"></up-icon></view></view>
<view class="shop-item"><view class="item-title" bindtap="{{b}}"><view>{{a}}</view><view>待付款</view></view><view class="item-body" bindtap="{{e}}"><view class="body-content"><view wx:for="{{c}}" wx:for-item="item" wx:key="b"><image class="image" src="{{item.a}}"></image></view></view><view class="all">共5件商品, 总金额 <text>¥{{d}}</text></view></view><view wx:if="{{f}}" class="item-btn"><view style="width:80px"><up-button wx:if="{{g}}" u-s="{{['d']}}" u-i="e1c5d592-0" bind:__l="__l" u-p="{{g}}">取消订单</up-button></view><view style="width:80px"><up-button wx:if="{{h}}" u-s="{{['d']}}" u-i="e1c5d592-1" bind:__l="__l" u-p="{{h}}">立即支付</up-button></view></view><view wx:if="{{i}}" class="item-btn"><view style="width:80px"><up-button wx:if="{{j}}" u-s="{{['d']}}" u-i="e1c5d592-2" bind:__l="__l" u-p="{{j}}">申请售后</up-button></view><view style="width:80px"><up-button wx:if="{{k}}" u-s="{{['d']}}" u-i="e1c5d592-3" bind:__l="__l" u-p="{{k}}">确认收货</up-button></view><view style="width:80px"><up-button wx:if="{{l}}" u-s="{{['d']}}" u-i="e1c5d592-4" bind:__l="__l" u-p="{{l}}">再次购买</up-button></view></view><view wx:if="{{m}}" class="item-close"><view class="title"><view class="type">退款申请中</view><view>等待商家处理</view></view><up-icon wx:if="{{n}}" u-i="e1c5d592-5" bind:__l="__l" u-p="{{n}}"></up-icon></view></view>

View File

@ -25,7 +25,6 @@
/* 文章场景相关 */
.shop-item {
width: 710rpx;
height: 340rpx;
margin-bottom: 20rpx;
background-color: #fff;
border-radius: 14rpx;
@ -37,22 +36,17 @@
justify-content: space-between;
}
.shop-item .item-body {
display: flex;
justify-content: space-between;
margin: 20rpx 0;
}
.shop-item .item-body .image {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.shop-item .item-body .body-content {
width: 490rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
color: #989898;
}
.shop-item .item-body .body-content .image {
width: 120rpx;
height: 120rpx;
margin-right: 20rpx;
}
.shop-item .item-body .body-content .title {
display: flex;
justify-content: space-between;
@ -65,11 +59,11 @@
font-size: 24rpx;
margin-top: 10rpx;
}
.shop-item .item-body .body-content .all {
align-self: flex-end;
.shop-item .item-body .all {
text-align: right;
font-size: 26rpx;
}
.shop-item .item-body .body-content .all text {
.shop-item .item-body .all text {
color: #F55726;
}
.shop-item .item-btn {

View File

@ -1,5 +1,9 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const api_order = require("../../api/order.js");
require("../../utils/request.js");
require("../../config/app.js");
require("../../store/user.js");
if (!Array) {
const _easycom_up_search2 = common_vendor.resolveComponent("up-search");
const _easycom_up_tabs2 = common_vendor.resolveComponent("up-tabs");
@ -34,14 +38,31 @@ const _sfc_main = {
swiperCurrent.value = current;
tabsActive.value = current;
};
const where = common_vendor.ref({
page_no: 1,
page_size: 25
});
const orderList = common_vendor.ref([
[],
[],
[]
]);
const getOrderList = (type = 0) => {
api_order.orderListApi({
...where.value
}).then((res) => {
orderList.value[type] = res.data.lists;
});
};
common_vendor.onLoad((options) => {
if (options.type) {
tabsActive.value = +options.type;
swiperCurrent.value = +options.type;
}
getOrderList();
});
return (_ctx, _cache) => {
return common_vendor.e({
return {
a: common_vendor.p({
shape: "round",
actionStyle: {
@ -61,41 +82,26 @@ const _sfc_main = {
}),
d: common_vendor.p({
bgColor: "#fff"
})
}, {
e: common_vendor.f(10, (item, index, i0) => {
return {
a: index,
b: "aea1ad54-3-" + i0
};
}),
f: common_vendor.p({
type: 0
})
}, {
h: common_vendor.f(10, (item, index, i0) => {
return {
a: index,
b: "aea1ad54-5-" + i0
};
e: common_vendor.f(orderList.value, (list, k, i0) => {
return common_vendor.e({
a: common_vendor.f(list, (item, index, i1) => {
return {
a: index,
b: "aea1ad54-3-" + i0 + "-" + i1,
c: common_vendor.p({
datas: item,
type: k
})
};
})
}, {
d: k
});
}),
i: common_vendor.p({
type: 1
})
}, {
k: common_vendor.f(10, (item, index, i0) => {
return {
a: index,
b: "aea1ad54-7-" + i0
};
}),
l: common_vendor.p({
type: 2
})
}, {
n: swiperCurrent.value,
o: common_vendor.o(animationfinish)
});
f: swiperCurrent.value,
g: common_vendor.o(animationfinish)
};
};
}
};

View File

@ -1 +1 @@
<view><up-sticky wx:if="{{d}}" u-s="{{['d']}}" u-i="aea1ad54-0" bind:__l="__l" u-p="{{d}}"><view style="padding:10rpx 20rpx 0 20rpx"><up-search wx:if="{{a}}" u-i="aea1ad54-1,aea1ad54-0" bind:__l="__l" u-p="{{a}}"></up-search></view><up-tabs wx:if="{{c}}" bindchange="{{b}}" u-i="aea1ad54-2,aea1ad54-0" bind:__l="__l" u-p="{{c}}"></up-tabs></up-sticky><swiper class="swiper-box" current="{{n}}" bindanimationfinish="{{o}}"><swiper-item class="swiper-item"><scroll-view scroll-y style="height:100%;width:100%"><view class="page-box"><view wx:if="{{true}}" class="list"><good wx:for="{{e}}" wx:for-item="item" wx:key="a" u-i="{{item.b}}" bind:__l="__l" u-p="{{f}}"></good></view><view wx:else style="padding-top:100rpx"><up-empty wx:if="{{g}}" u-i="aea1ad54-4" 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-box"><view wx:if="{{true}}" class="list"><good wx:for="{{h}}" wx:for-item="item" wx:key="a" u-i="{{item.b}}" bind:__l="__l" u-p="{{i}}"></good></view><view wx:else style="padding-top:100rpx"><up-empty wx:if="{{j}}" u-i="aea1ad54-6" bind:__l="__l" u-p="{{j}}"></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-box"><view wx:if="{{true}}" class="list"><good wx:for="{{k}}" wx:for-item="item" wx:key="a" u-i="{{item.b}}" bind:__l="__l" u-p="{{l}}"></good></view><view wx:else style="padding-top:100rpx"><up-empty wx:if="{{m}}" u-i="aea1ad54-8" bind:__l="__l" u-p="{{m}}"></up-empty></view><view style="width:100%;height:200rpx"></view></view></scroll-view></swiper-item></swiper></view>
<view><up-sticky wx:if="{{d}}" u-s="{{['d']}}" u-i="aea1ad54-0" bind:__l="__l" u-p="{{d}}"><view style="padding:10rpx 20rpx 0 20rpx"><up-search wx:if="{{a}}" u-i="aea1ad54-1,aea1ad54-0" bind:__l="__l" u-p="{{a}}"></up-search></view><up-tabs wx:if="{{c}}" bindchange="{{b}}" u-i="aea1ad54-2,aea1ad54-0" bind:__l="__l" u-p="{{c}}"></up-tabs></up-sticky><swiper class="swiper-box" current="{{f}}" bindanimationfinish="{{g}}"><swiper-item wx:for="{{e}}" wx:for-item="list" wx:key="d" class="swiper-item"><scroll-view scroll-y style="height:100%;width:100%"><view class="page-box"><view wx:if="{{true}}" class="list"><good wx:for="{{list.a}}" wx:for-item="item" wx:key="a" u-i="{{item.b}}" bind:__l="__l" u-p="{{item.c}}"></good></view><view wx:else style="padding-top:100rpx"><up-empty wx:if="{{list.c}}" u-i="{{list.b}}" bind:__l="__l" u-p="{{list.c}}"></up-empty></view><view style="width:100%;height:200rpx"></view></view></scroll-view></swiper-item></swiper></view>

View File

@ -1,5 +1,9 @@
{
"description": "项目配置文件。",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"urlCheck": false,
"es6": true,
@ -7,11 +11,7 @@
"minified": false,
"newFeature": true,
"bigPackageSizeSupport": true,
"coverView": false,
"condition": false,
"enhance": false,
"showShadowRootInWxmlPanel": false,
"packNpmRelationList": [],
"ignoreUploadUnusedFiles": true,
"babelSetting": {
"ignore": [],
@ -20,6 +20,9 @@
}
},
"compileType": "miniprogram",
"libVersion": "3.4.2",
"appid": "wxce2948c50d808b66",
"projectname": "purchase-let",
"condition": {
"search": {
"current": -1,
@ -41,11 +44,5 @@
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"libVersion": "3.4.2",
"packOptions": {
"ignore": [],
"include": []
},
"appid": "wxce2948c50d808b66"
}
}

View File

@ -9,7 +9,7 @@
"list": [
{
"name": "",
"pathName": "pagesOrder/settle/settle",
"pathName": "pages/login/login",
"query": "",
"launchMode": "default",
"scene": null

View File

@ -30,7 +30,7 @@ function baseRequest(url, method, data, {
if (res.data.show) {
uni.showToast({
title: res.data.msg || '操作成功',
icon: 'success',
icon: 'none',
})
}
if (noVerify)