new files

This commit is contained in:
panchengyong
2026-03-07 22:29:07 +08:00
parent cd7e80b502
commit 7acbf45ff7
12516 changed files with 1808447 additions and 194 deletions

View File

@@ -0,0 +1,115 @@
<template>
<base-drawer mode="bottom" :visible="cartData.iScart" background-color="transparent" mask maskClosable @close="closeList">
<view class="bg--w111-fff rd-t-40rpx p-32">
<view class="text-center fs-32 text--w111-333 fw-500">待购清单</view>
<view class="mt-36">
<scroll-view scroll-y="true" style="max-height: 1000rpx;">
<view class="w-full flex-between-center item"
v-for="(item,index) in cartData.cartList" :key="index">
<text class="iconfont fs-36"
:class="item.select ? 'icon-a-ic_CompleteSelect' : 'icon-ic_unselect'"
@tap="selectItem(item,index)"></text>
<view class="flex-1 flex pl-18">
<image v-if="item.productInfo.attrInfo" :src="item.productInfo.attrInfo.image" class="w-136 h-136 rd-16rpx block"></image>
<image v-else :src="item.productInfo.image" class="w-136 h-136 rd-16rpx block"></image>
<view class='flex-1 h-136 pl-20'>
<view class="w-340 line1 fs-28 lh-40rpx fw-500">{{item.productInfo.store_name}}</view>
<view class="w-324 line1 fs-22 lh-30rpx text--w111-999 mt-12">{{item.productInfo.attrInfo.suk}}</view>
<view class="flex-1 flex-between-center mt-18">
<view class="fs-36 Regular">¥{{item.truePrice}}</view>
<view class="flex-y-center">
<text class="iconfont icon-ic_Reduce fs-24"
:class="item.cart_num <= 1 ? 'text--w111-f5f5f5' : ''"
@tap="cartNumAdd(false,item,index)"></text>
<input type="number" v-model="item.cart_num"
:always-embed="true" :adjust-position="true" cursor-spacing="30"
class="w-88 h-44 rd-4rpx bg--w111-f5f5f5 fs-24 text-center mx-10"></input>
<text class="iconfont icon-ic_increase fs-24" @tap="cartNumAdd(true,item,index)"></text>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="bt-box"></view>
<view class="w-full fixed-lb pb-safe bg--w111-fff">
<view class="w-full h-96 pl-32 pr-20 flex-between-center">
<view class="flex-y-center" @tap="selectAll">
<text class="iconfont fs-36" :class="allSelect ? 'icon-a-ic_CompleteSelect' : 'icon-ic_unselect'"></text>
<text class="fs-26 pl-12">全选</text>
</view>
<view class="flex-y-center">
<view class="w-160 h-64 rd-40rpx flex-center fs-24 con_border text-primary" @tap="cartDel">删除</view>
<view class="w-160 h-64 rd-40rpx flex-center fs-24 bg-primary text--w111-fff ml-16" @tap="cartConfirm">下单</view>
</view>
</view>
</view>
</view>
</base-drawer>
</template>
<script>
import baseDrawer from '@/components/tui-drawer/tui-drawer.vue'
export default {
name:'cartList',
props:{
cartData: {
type: Object,
default: () => {}
},
},
data(){
return {
allSelect: false
}
},
components:{
baseDrawer
},
methods:{
closeList(){
this.$emit('closeList', false);
},
selectItem(item,index){
this.$emit('onSelect',index);
},
selectAll(){
this.$emit('onSelectAll',this.allSelect);
this.allSelect = !this.allSelect;
},
cartDel(){
this.$emit('onDelCart');
},
cartConfirm(){
this.$emit('onCartConfirm');
},
cartNumAdd(type,item,index){
this.$emit('onCartNum',{type,item,index});
},
}
}
</script>
<style lang="scss" scoped>
.icon-ic_unselect{
color: #ccc;
}
.icon-a-ic_CompleteSelect{
color: $primary-admin;
}
.text-primary {
color: $primary-admin;
}
.bg-primary{
background: $primary-admin;
}
.con_border {
border: 1rpx solid $primary-admin;
}
.bt-box{
height: calc(100rpx + env(safe-area-inset-bottom));
}
.item ~ .item{
margin-top: 48rpx;
}
</style>

View File

@@ -0,0 +1,95 @@
<template>
<base-drawer mode="bottom" :visible="visible" background-color="transparent" mask maskClosable @close="closeDrawer">
<view class="w-100% bg--w111-f5f5f5 rd-t-40rpx py-32">
<view class="text-center fs-32 text--w111-333 fw-500">赠品</view>
<view class="mt-48 px-20 scroll-content">
<view class="text--w111-333 fs-28 lh-40rpx">本单可获得以下赠品</view>
<view class="gift-card mt-24 bg--w111-fff rd-16rpx p-16 flex-y-center"
v-for="(item,index) in giveCartInfo" :key="item.id" @tap="goPage(1,'/pages/goods_details/index?id=' + item.productInfo.id)">
<image class="w-116 h-116 rd-16rpx" :src="item.productInfo.attrInfo.image" v-if="item.productInfo.attrInfo"></image>
<image class="w-116 h-116 rd-16rpx" :src="item.productInfo.image" v-else></image>
<view class="flex-1 flex-between-center pl-16">
<view class="w-460">
<view class="w-full line1 fs-28 lh-40rpx">{{item.productInfo.store_name}}</view>
<view class="fs-22 text--w111-999 lh-30rpx mt-12">数量x{{item.cart_num}}</view>
</view>
<text class="iconfont icon-ic_rightarrow fs-24 text--w111-999"></text>
</view>
</view>
<view class="gift-card mt-24 bg--w111-fff rd-16rpx p-16 flex-y-center"
v-for="(item,index) in giveData.give_coupon" :key="index" @tap="goPage(1,'/pages/users/user_coupon/index')">
<view class="w-116 h-116 rd-16rpx flex-center bg--w111-f5f5f5">
<text class="fs-48 gold iconfont icon-a-ic_discount1"></text>
</view>
<view class="flex-1 flex-between-center pl-16">
<view class="w-460">
<view class="w-full line1 fs-28 lh-40rpx">{{item.coupon_title}}</view>
<view class="fs-22 text--w111-999 lh-30rpx mt-12">数量x1</view>
</view>
<text class="iconfont icon-ic_rightarrow fs-24 text--w111-999"></text>
</view>
</view>
<view class="gift-card mt-24 bg--w111-fff rd-16rpx p-16 flex-y-center"
v-if="giveData.give_integral>0"
@tap="goPage(1,'/pages/users/user_integral/index')">
<view class="w-116 h-116 rd-16rpx flex-center bg--w111-f5f5f5">
<text class="fs-48 gold iconfont icon-ic_badge11"></text>
</view>
<view class="flex-1 flex-between-center pl-16">
<view class="w-460">
<view class="w-full line1 fs-28 lh-40rpx">{{giveData.give_integral}}积分</view>
<view class="fs-22 text--w111-999 lh-30rpx mt-12">数量x1</view>
</view>
<text class="iconfont icon-ic_rightarrow fs-24 text--w111-999"></text>
</view>
</view>
</view>
<view class="mx-20">
<view class="mt-52 h-72 flex-center rd-36px bg-color fs-26 text--w111-fff" @tap="showGiftDrawer = false">确定</view>
</view>
</view>
</base-drawer>
</template>
<script>
import baseDrawer from '@/components/tui-drawer/tui-drawer.vue';
export default {
props:{
visible: {
type: Boolean,
default: false,
},
giveCartInfo:{
type: Array,
default: ()=>[]
},
giveData:{
type: Object,
default: ()=>{}
},
},
components: {
baseDrawer
},
methods:{
closeDrawer() {
this.$emit('closeDrawer');
},
goPage(type,url){
uni.navigateTo({
url
})
}
}
}
</script>
<style>
.gold{
color: #DCA658;
}
.scroll-content{
height: 800rpx;
overflow-y: auto;
}
</style>

View File

@@ -0,0 +1,174 @@
<template>
<base-drawer mode="bottom" :visible="attr.cartAttr" background-color="transparent" mask maskClosable
@close="closeAttr">
<view class="scroll-content bg--w111-fff rd-t-40rpx">
<view class="w-full pt-32">
<view class="px-32 flex">
<image class="w-180 h-180 rd-16rpx" :src="attr.productSelect.image"></image>
<view class="pl-24 mt-30">
<baseMoney :money="attr.productSelect.price" symbolSize="32" integerSize="48"
decimalSize="32" color="#FF7E00" weight></baseMoney>
<view class="fs-24 pt-10 text--w111-FF7E00" v-show="is_channel">采购价:{{attr.productSelect.channel_price}}</view>
<view class="mt-20 fs-24 text--w111-999">库存:{{ attr.productSelect.stock }}</view>
</view>
</view>
</view>
<view class="px-32">
<scroll-view scroll-y="true" style="max-height: 454rpx" >
<view class="item mt-32" v-for="(item, indexw) in attr.productAttr" :key="indexw">
<view class="fs-28 fw-500">{{ item.attr_name }}</view>
<view class="flex-y-center flex-wrap">
<view class="sku-item" :class="item.index === itemn.attr ? 'active' : ''"
v-for="(itemn, indexn) in item.attr_value" @click="tapAttr(indexw, indexn)"
:key="indexn">
{{ itemn.attr }}
</view>
</view>
</view>
</scroll-view>
</view>
<view class="flex-between-center mt-40 px-32">
<view class="fs-28 fw-500">数量</view>
<view class="flex-1 flex justify-end items-center">
<text class="fs-22 text-primary">最多可购买{{attr.productSelect.stock}}</text>
<view class="flex-y-center pl-24">
<text class="iconfont icon-ic_Reduce fs-24"
:class="attr.productSelect.cart_num <= 1 ? 'text--w111-f5f5f5' : ''"
@tap="CartNumDes"></text>
<input type="number" v-model="attr.productSelect.cart_num"
data-name="productSelect.cart_num" :always-embed="true" :adjust-position="true" cursor-spacing="30"
@input="bindCode(attr.productSelect.cart_num)" class="w-88 h-44 rd-4rpx bg--w111-f5f5f5 fs-24 text-center mx-10"></input>
<text class="iconfont icon-ic_increase fs-24" @tap="CartNumAdd"></text>
</view>
</view>
</view>
<view class="btn-box" v-show="attr.productSelect.stock == 0">
<view class="w-full h-72 rd-40rpx flex-center fs-26 bg--w111-ccc text--w111-fff">已售罄</view>
</view>
<view class="btn-box flex-between-center" v-show="attr.productSelect.stock > 0">
<view class="w-346 h-72 rd-40rpx flex-center fs-26 con_border text-primary"
:class="{'disabled': cartButton == 0}"
@tap="goCart(0)">加入购物车</view>
<view class="w-346 h-72 rd-40rpx flex-center fs-26 bg-primary text--w111-fff" @tap="goCart(1)">立即下单</view>
</view>
</view>
</base-drawer>
</template>
<script>
import baseDrawer from '@/components/tui-drawer/tui-drawer.vue'
export default {
name:'skuSelect',
props:{
attr: {
type: Object,
default: () => {}
},
cartButton:{
type: Number,
default: 1
},
is_channel:{
type: String,
default: ""
}
},
data(){
return {
}
},
components:{
baseDrawer
},
methods:{
goCart(type) {
if(type == 0 && this.cartButton == 0) return
if(this.attr.productSelect.stock == 0) return
this.$emit('goCat',type);
},
bindCode: function(e) {
this.$emit('iptCartNum', this.attr.productSelect.cart_num);
},
closeAttr: function() {
this.$emit('myevent');
},
CartNumDes: function() {
this.$emit('ChangeCartNum', false);
},
CartNumAdd: function() {
this.$emit('ChangeCartNum', true);
},
tapAttr: function(indexw, indexn) {
let that = this;
that.$emit("attrVal", {
indexw: indexw,
indexn: indexn
});
this.$set(this.attr.productAttr[indexw], 'index', this.attr.productAttr[indexw].attr_values[indexn]);
let value = that
.getCheckedValue()
.join(",");
that.$emit("ChangeAttr", value);
},
//获取被选中属性;
getCheckedValue: function() {
let productAttr = this.attr.productAttr;
let value = [];
for (let i = 0; i < productAttr.length; i++) {
for (let j = 0; j < productAttr[i].attr_values.length; j++) {
if (productAttr[i].index === productAttr[i].attr_values[j]) {
value.push(productAttr[i].attr_values[j]);
}
}
}
return value;
},
}
}
</script>
<style lang="scss" scoped>
.sku-item {
height: 56rpx;
line-height: 56rpx;
border: 1rpx solid #F2F2F2;
font-size: 24rpx;
color: #333;
padding: 0 44rpx;
border-radius: 28rpx;
margin: 24rpx 0 0 16rpx;
background-color: #F2F2F2;
word-break: break-all;
}
.active {
color: $primary-admin;
background: $light-primary-admin;
border-color: $primary-admin;
}
.text-primary {
color: $primary-admin;
}
.bg-primary{
background: $primary-admin;
}
.con_border {
border: 1rpx solid $primary-admin;
}
.btn-box{
padding:0 20rpx calc(20rpx + env(safe-area-inset-bottom));
margin: 78rpx auto 0;
}
.disabled{
background-color: #ccc;
color: #fff;
border: 1rpx solid #ccc;
}
.text--w111-FF7E00{
color: #FF7E00;
}
</style>

View File

@@ -0,0 +1,251 @@
import { adminCartAdd, adminCartDel, adminCartNum } from "@/api/admin.js"
export default {
data() {
return {
attr: {
cartAttr: false,
productAttr: [],
productSelect: {}
},
productValue: [],
};
},
created() {
},
methods: {
/**
* 默认选中属性
*
*/
DefaultSelect: function() {
let productAttr = this.attr.productAttr;
let valueobj = [];
let value = [];
for (var key in this.productValue) {
if (this.productValue[key].stock > 0) {
valueobj = this.attr.productAttr.length ? key.split(',') : [];
break;
}
}
// 处理已售罄时默认选中第一个
if (!valueobj.length && this.attr.productAttr.length) {
value = Object.keys(this.productValue)[0].split(',');
} else {
value = valueobj;
}
for (let i = 0; i < productAttr.length; i++) {
this.$set(productAttr[i], 'index', value[i]);
}
//sort();排序函数:数字-英文-汉字;
let productSelect = this.productValue[value.join(',')];
this.$set(this.attr.productSelect, 'store_name', this.storeInfo.store_name);
if (productSelect && productAttr.length) {
this.$set(this.attr.productSelect, 'image', productSelect.image);
this.$set(this.attr.productSelect, 'price', productSelect.price);
this.$set(this.attr.productSelect, 'channel_price', productSelect.channel_price || '');
this.$set(this.attr.productSelect, 'stock', productSelect.stock);
this.$set(this.attr.productSelect, 'unique', productSelect.unique);
this.$set(this.attr.productSelect, 'cart_num', 1);
this.$set(this, 'attrValue', value.join(','));
this.$set(this.attr.productSelect, 'vip_price', productSelect.vip_price);
this.$set(this, 'attrTxt', '已选择');
} else if (!productSelect && productAttr.length) {
this.$set(this.attr.productSelect, 'image', this.storeInfo.image);
this.$set(this.attr.productSelect, 'price', this.storeInfo.price);
this.$set(this.attr.productSelect, 'channel_price', this.storeInfo.price);
this.$set(this.attr.productSelect, 'stock', 0);
this.$set(this.attr.productSelect, 'unique', '');
this.$set(this.attr.productSelect, 'cart_num', 0);
this.$set(this.attr.productSelect, 'vip_price', this.storeInfo.vip_price);
this.$set(this, 'attrValue', '');
this.$set(this, 'attrTxt', '请选择');
} else if (!productSelect && !productAttr.length) {
this.$set(this.attr.productSelect, 'image', this.storeInfo.image);
this.$set(this.attr.productSelect, 'price', this.storeInfo.price);
this.$set(this.attr.productSelect, 'channel_price', this.storeInfo.price);
this.$set(this.attr.productSelect, 'stock', this.storeInfo.stock);
this.$set(this.attr.productSelect, 'unique', this.storeInfo.unique || '');
this.$set(this.attr.productSelect, 'cart_num', 1);
this.$set(this.attr.productSelect, 'vip_price', this.storeInfo.vip_price);
this.$set(this, 'attrValue', '');
this.$set(this, 'attrTxt', '请选择');
}
},
/**
* 属性变动赋值
*
*/
ChangeAttr: function(res) {
let productSelect = this.productValue[res];
this.$set(this, "selectSku", productSelect);
if (productSelect && productSelect.stock >= 0) {
this.$set(this.attr.productSelect, 'image', productSelect.image);
this.$set(this.attr.productSelect, 'price', productSelect.price);
this.$set(this.attr.productSelect, 'channel_price', productSelect.channel_price || '');
this.$set(this.attr.productSelect, 'stock', productSelect.stock);
this.$set(this.attr.productSelect, 'unique', productSelect.unique);
this.$set(this.attr.productSelect, 'cart_num', 1);
this.$set(this.attr.productSelect, 'vip_price', productSelect.vip_price);
this.$set(this, 'attrValue', res);
this.$set(this, 'attrTxt', '已选择');
} else {
this.$set(this.attr.productSelect, 'image', this.storeInfo.image);
this.$set(this.attr.productSelect, 'price', this.storeInfo.price);
this.$set(this.attr.productSelect, 'channel_price', this.storeInfo.price);
this.$set(this.attr.productSelect, 'stock', 0);
this.$set(this.attr.productSelect, 'unique', '');
this.$set(this.attr.productSelect, 'cart_num', 0);
this.$set(this.attr.productSelect, 'vip_price', this.storeInfo.vip_price);
this.$set(this, 'attrValue', '');
this.$set(this, 'attrTxt', '请选择');
}
},
attrVal(val) {
this.$set(this.attr.productAttr[val.indexw], 'index', this.attr.productAttr[val.indexw].attr_values[val
.indexn]);
},
/**
* 购物车手动填写
*
*/
iptCartNum: function(e) {
this.$set(this.attr.productSelect, 'cart_num', e);
},
onMyEvent: function() {
this.$set(this.attr, 'cartAttr', false);
},
// 改变多属性购物车
ChangeCartNumDuo(changeValue) {
if(changeValue){
if(this.attr.productSelect.cart_num == this.attr.productSelect.stock) return this.$util.Tips({
title: '该产品没有更多库存了'
});
this.attr.productSelect.cart_num++;
}else{
if(this.attr.productSelect.cart_num == 1) return
this.attr.productSelect.cart_num--;
}
},
// 多规格加入购物车;
goCatNum(type) {
this.goCartChange(true,null,type);
},
goCartChange(duo, productId,type){
let data = {
productId: duo ? this.id : productId,
cartNum: duo ? this.attr.productSelect.cart_num : 1,
uniqueId: duo ? this.attr.productSelect.unique : "",
'new':type,
tourist_uid: this.touristId,
is_channel: this.is_channel
};
adminCartAdd(this.userId,data).then(res=>{
if(duo){
this.attr.cartAttr = false;
}
if(type){
uni.navigateTo({
url: `/pages/behalf/order_confirm/index?cartId=${res.data.cartId}&uid=${this.userId}&news=1`
});
}
this.$util.Tips({
title: '加入购物车成功'
});
this.getCartList(1);
}).catch(err => {
return this.$util.Tips({
title: err
});
});
},
goCartDuo(item) {
if (!this.isLogin) {
toLogin();
} else {
this.storeName = item.store_name;
this.getAttrs(item.id);
this.$set(this, 'id', item.id);
this.$set(this.attr, 'cartAttr', true);
}
},
// 点击默认单属性购物车
goCartDan(item) {
if (!this.isLogin) {
this.getIsLogin();
} else {
this.goCartChange(false, item.id,item.cart_button == 1 ? 0 : 1);
}
},
closeList(e) {
this.$set(this.cartData, 'iScart', e);
},
selectitem(index){
this.cartData.cartList[index].select = !this.cartData.cartList[index].select;
let isSelect = this.cartData.cartList.filter(el=> el.select == true);
if(isSelect.length == this.cartData.cartList.length){
this.$refs.cartPopup.allSelect = true;
}else{
this.$refs.cartPopup.allSelect = false;
}
},
selectAll(val){
this.cartData.cartList.map(item=>{
this.$set(item,'select',val ? false : true);
})
},
cartDelChange(){
let ids = [];
this.cartData.cartList.forEach(item=>{
if(item.select){
ids.push(item.id);
}
})
if(!ids.length) return this.$util.Tips({
title: '请先选择商品'
});
adminCartDel(this.userId,{
ids: ids.toString(),
tourist_uid: this.touristId,
}).then(res=>{
this.getCartList(0);
this.$util.Tips({
title: err
});
}).catch(err => {
return this.$util.Tips({
title: err
});
});
},
cartNumChange(data){
if(data.type){
if(data.item.cart_num == data.item.productInfo.attrInfo.stock) return this.$util.Tips({
title: '该产品没有更多库存了'
});
}else{
if(data.item.cart_num == 1) return
}
adminCartNum(this.userId,{
id: data.item.id,
number: data.type ? data.item.cart_num + 1 : data.item.cart_num - 1,
tourist_uid: this.touristId
}).then(res=>{
if(data.type){
this.cartData.cartList[data.index].cart_num++;
}else{
this.cartData.cartList[data.index].cart_num--;
}
this.getTotalPrice();
this.$util.Tips({
title: res.msg
});
}).catch(err => {
return this.$util.Tips({
title: err
});
});
}
}
};