更新
This commit is contained in:
parent
bcd7e001c4
commit
c1c342d504
@ -302,7 +302,10 @@ export function storeActivityQrcode(data) {
|
|||||||
|
|
||||||
// 活动商品专区
|
// 活动商品专区
|
||||||
export function storeActivityProduct(data) {
|
export function storeActivityProduct(data) {
|
||||||
return request.get(`storeActivity/product`, data, {
|
return request.get(`storeActivity/product`, data);
|
||||||
noAuth: true
|
}
|
||||||
});
|
|
||||||
|
// 活动区域列表
|
||||||
|
export function storeActivityDistrict(data) {
|
||||||
|
return request.get(`storeActivity/district`, data);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<view class="flex flex_end">
|
<view class="flex flex_end">
|
||||||
<view class="price">¥<text class="pro">{{leftPrice}}.</text>{{rightPrice}}
|
<view class="price">¥<text class="pro">{{leftPrice}}.</text>{{rightPrice}}
|
||||||
</view>
|
</view>
|
||||||
<view>订货价</view>
|
<!-- <view>订货价</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="short_name">{{datas.store_name}}</view>
|
<view class="short_name">{{datas.store_name}}</view>
|
||||||
<view class="flex">
|
<view class="flex">
|
||||||
|
@ -20,9 +20,13 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="white_card">
|
<view class="white_card">
|
||||||
<view class="flex flex_end">
|
<view class="flex flex_end">
|
||||||
<view class="price">¥<text class="pro">{{leftPrice}}.</text>{{rightPrice}}
|
<block v-if="datas.limited_price">
|
||||||
</view>
|
<view class="price">¥<text class="pro">{{leftPrice2}}.</text>{{rightPrice2}}
|
||||||
<view>订货价</view>
|
</view>
|
||||||
|
<view class="price" style="text-decoration: line-through;color: #999;font-weight: 400;font-size: 28rpx;">原价: ¥<text>{{leftPrice}}.</text>{{rightPrice}}</view>
|
||||||
|
</block>
|
||||||
|
<view v-else class="price">¥<text>{{leftPrice}}.</text>{{rightPrice}}</view>
|
||||||
|
<!-- <view>订货价</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="short_name">{{datas.store_name}}</view>
|
<view class="short_name">{{datas.store_name}}</view>
|
||||||
<view class="flex">
|
<view class="flex">
|
||||||
@ -56,11 +60,11 @@
|
|||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<view class="button">
|
<view class="button">
|
||||||
<view class="b_icon" @click="navgoCart()">
|
<!-- <view class="b_icon" @click="navgoCart()">
|
||||||
<image src="@/static/images/icon/car.png"></image>
|
<image src="@/static/images/icon/car.png"></image>
|
||||||
<view>购物车</view>
|
<view>购物车</view>
|
||||||
<view class="badge" v-if="goodsNum">{{goodsNum}}</view>
|
<view class="badge" v-if="goodsNum">{{goodsNum}}</view>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="btn" @click.stop="$u.throttle(addcart, 1500)"> {{isBuy?'立即购买':'加入购物车'}} </view>
|
<view class="btn" @click.stop="$u.throttle(addcart, 1500)"> {{isBuy?'立即购买':'加入购物车'}} </view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -74,6 +78,7 @@
|
|||||||
getProductDetail
|
getProductDetail
|
||||||
} from '@/api/store.js';
|
} from '@/api/store.js';
|
||||||
import { Toast } from '../libs/uniApi';
|
import { Toast } from '../libs/uniApi';
|
||||||
|
import { data } from '../uni_modules/uview-ui/libs/mixin/mixin';
|
||||||
export default {
|
export default {
|
||||||
name: "shortPopup",
|
name: "shortPopup",
|
||||||
props: {
|
props: {
|
||||||
@ -120,6 +125,12 @@ import { Toast } from '../libs/uniApi';
|
|||||||
},
|
},
|
||||||
rightPrice(){
|
rightPrice(){
|
||||||
return this.sku[this.changeSkuKey]?.price?.split('.')[1]||'00';
|
return this.sku[this.changeSkuKey]?.price?.split('.')[1]||'00';
|
||||||
|
},
|
||||||
|
leftPrice2(){
|
||||||
|
return this.datas.limited_price.split('.')[0]||'0';
|
||||||
|
},
|
||||||
|
rightPrice2(){
|
||||||
|
return this.datas.limited_price.split('.')[1]||'00';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -231,7 +231,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
navigatorBack(){
|
navigatorBack(){
|
||||||
if(this.searchValue!==''&&this.searchValue!==undefined&&this.searchValue!==null){
|
if(this.searchValue!==undefined&&this.searchValue!==null){
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
success:()=> {
|
success:()=> {
|
||||||
uni.$emit('searchValue', this.searchValue);
|
uni.$emit('searchValue', this.searchValue);
|
||||||
|
@ -144,7 +144,7 @@
|
|||||||
<activityCard @close="closeActivityCard"></activityCard>
|
<activityCard @close="closeActivityCard"></activityCard>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
|
|
||||||
<activityHome @click="navgo('/pages/newActivity/towPrice/towPrice?street_id='+street_id)"></activityHome>
|
<activityHome @click="navgo(`/pages/newActivity/towPrice/towPrice?street_id=${street_id}&townName=${street}`)"></activityHome>
|
||||||
<!-- <m-tabbar native>
|
<!-- <m-tabbar native>
|
||||||
<template v-slot:tabbar_index_2>
|
<template v-slot:tabbar_index_2>
|
||||||
<view class="custom_style">
|
<view class="custom_style">
|
||||||
@ -229,12 +229,12 @@ import activityCard from "@/components/activityCard.vue"
|
|||||||
where: {
|
where: {
|
||||||
category_id: 0,
|
category_id: 0,
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 10
|
limit: 30
|
||||||
},
|
},
|
||||||
where2: {
|
where2: {
|
||||||
category_id: 0,
|
category_id: 0,
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 10
|
limit: 30
|
||||||
},
|
},
|
||||||
|
|
||||||
currentItemId: 69, // 默认获取 社区的数据 0 表示推荐 || 69 社区
|
currentItemId: 69, // 默认获取 社区的数据 0 表示推荐 || 69 社区
|
||||||
@ -257,6 +257,7 @@ import activityCard from "@/components/activityCard.vue"
|
|||||||
loadend2: false,
|
loadend2: false,
|
||||||
loading2: false,
|
loading2: false,
|
||||||
loadTitle2: '加载更多',
|
loadTitle2: '加载更多',
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
@ -360,23 +361,29 @@ import activityCard from "@/components/activityCard.vue"
|
|||||||
this.selfLocation()
|
this.selfLocation()
|
||||||
|
|
||||||
},
|
},
|
||||||
|
shuffleArray(array) { // 洗牌算法
|
||||||
|
for (let i = array.length - 1; i > 0; i--) {
|
||||||
|
let j = Math.floor(Math.random() * (i + 1));
|
||||||
|
let temp = array[i];
|
||||||
|
array[i] = array[j];
|
||||||
|
array[j] = temp;
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
},
|
||||||
|
|
||||||
//获取商品列表
|
//获取商品列表
|
||||||
list(isPage=false, id) {
|
list(isPage=false, id) {
|
||||||
if(!id||this.loadend) return this.list2(true, ''); // 定位没有获取到时,直接推荐
|
if(!id||this.loadend) return this.list2(true, ''); // 定位没有获取到时,直接推荐
|
||||||
let that = this;
|
let that = this;
|
||||||
if (that.loadend&&!isPage) return;
|
if (that.loadend&&!isPage) return;
|
||||||
if (that.loading&&!isPage) return;
|
if (that.loading&&!isPage) return;
|
||||||
|
if (isPage===true){
|
||||||
if (isPage === true) {
|
|
||||||
that.$set(that, 'productList', []);
|
|
||||||
that.$set(that, 'where', {
|
that.$set(that, 'where', {
|
||||||
category_id: 0,
|
category_id: 0,
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 10
|
limit: 30
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
that.$set(that, 'productList2', []);
|
|
||||||
|
|
||||||
that.loading = true;
|
that.loading = true;
|
||||||
that.loadTitle = '';
|
that.loadTitle = '';
|
||||||
getProductslist({
|
getProductslist({
|
||||||
@ -385,9 +392,15 @@ import activityCard from "@/components/activityCard.vue"
|
|||||||
street_id: id,
|
street_id: id,
|
||||||
type_id: '17,10',
|
type_id: '17,10',
|
||||||
location: `${this.latitude||''},${this.longitude||''}`
|
location: `${this.latitude||''},${this.longitude||''}`
|
||||||
}).then(res => {
|
}).then(async (res) => {
|
||||||
|
if (isPage === true) {
|
||||||
|
that.$set(that, 'productList', []);
|
||||||
|
}
|
||||||
|
that.$set(that, 'productList2', []);
|
||||||
|
// await that.$nextTick();
|
||||||
// console.log(222)
|
// console.log(222)
|
||||||
let list = res.data.list;
|
let list = res.data.list;
|
||||||
|
if(list.length>0) list = this.shuffleArray(list);
|
||||||
if (res.data.count == 0 && isPage) {
|
if (res.data.count == 0 && isPage) {
|
||||||
that.list2(true, '');
|
that.list2(true, '');
|
||||||
}
|
}
|
||||||
@ -417,7 +430,7 @@ import activityCard from "@/components/activityCard.vue"
|
|||||||
that.$set(that, 'where2', {
|
that.$set(that, 'where2', {
|
||||||
category_id: 0,
|
category_id: 0,
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 10
|
limit: 30
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
that.$set(that, 'productList', []);
|
that.$set(that, 'productList', []);
|
||||||
@ -431,6 +444,7 @@ import activityCard from "@/components/activityCard.vue"
|
|||||||
if(this.latitude&&this.longitude) query.location = this.latitude + ',' + this.longitude
|
if(this.latitude&&this.longitude) query.location = this.latitude + ',' + this.longitude
|
||||||
spuRecommend(query).then(res => {
|
spuRecommend(query).then(res => {
|
||||||
let list = res.data.list;
|
let list = res.data.list;
|
||||||
|
if(list.length>0) list = this.shuffleArray(list);
|
||||||
let productList = that.$util.SplitArray(list, that.productList2);
|
let productList = that.$util.SplitArray(list, that.productList2);
|
||||||
let loadend = list.length < that.where2.limit;
|
let loadend = list.length < that.where2.limit;
|
||||||
that.loadend2 = loadend;
|
that.loadend2 = loadend;
|
||||||
|
@ -8,27 +8,42 @@
|
|||||||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/back.png"></image>
|
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/back.png"></image>
|
||||||
<view class="b_body">
|
<view class="b_body">
|
||||||
<view class="b_content">
|
<view class="b_content">
|
||||||
<view style="padding-bottom: 16rpx;">当前活动区域为 <text style="color: #f84221;margin-left: 5rpx;" @click="changeAddress">[ {{address.townName||'未选择'}} ] , 点击切换</text></view>
|
<view style="padding-bottom: 16rpx;">
|
||||||
<view v-if="item.product" v-for="(item, index) in goodsList" class="short_item" @click="clickProduct(item)">
|
<picker :range="addressList" range-key="street_name" @change="changeAddress">
|
||||||
<image class="image" :src="item.product.image"></image>
|
<block v-if="address.street_id">
|
||||||
<view class="short_item_right">
|
当前活动区域为 <text style="color: #f84221;margin-left: 5rpx;">[ {{address.townName}} ] , 点击切换</text>
|
||||||
<view class="r_name">
|
</block>
|
||||||
<text v-if="item.mer_labels_name" class="mer-labels">{{item.mer_labels_name}}</text>{{item.product.store_name}}
|
<block v-else>
|
||||||
</view>
|
<text style="color: #f84221;margin-left: 5rpx;">当前区域 [ {{address.townName}} ] 没有活动 , 点击切换</text>
|
||||||
<view style="display: flex;justify-content: flex-start;margin-top: 5rpx;">
|
</block>
|
||||||
<view class="r_street" v-if="item.merchant">{{item.merchant.street_name}}</view>
|
</picker>
|
||||||
<view class="r_type" v-if="item.product.store_info||getSkuName(item)||item.unit_name">
|
</view>
|
||||||
<view v-if="getSkuName(item)">{{getSkuName(item)}}</view>
|
<block v-if="goodsList.length>0">
|
||||||
<view v-else-if="item.unit_name">{{item.unit_name}}</view>
|
<view v-if="item.product" v-for="(item, index) in goodsList" class="short_item" @click="clickProduct(item)">
|
||||||
|
<image class="image" :src="item.product.image"></image>
|
||||||
|
<view class="short_item_right">
|
||||||
|
<view class="r_name">
|
||||||
|
<text v-if="item.mer_labels_name" class="mer-labels">{{item.mer_labels_name}}</text>{{item.product.store_name}}
|
||||||
|
</view>
|
||||||
|
<view style="display: flex;justify-content: flex-start;margin-top: 5rpx;">
|
||||||
|
<view class="r_street" v-if="item.merchant">{{item.merchant.street_name}}</view>
|
||||||
|
<view class="r_type" v-if="item.product.store_info||getSkuName(item)||item.unit_name">
|
||||||
|
<view v-if="getSkuName(item)">{{getSkuName(item)}}</view>
|
||||||
|
<view v-else-if="item.unit_name">{{item.unit_name}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="r_btn" v-if="item.product && item.product.price">
|
||||||
|
<view style="color: #7f7f7f;">¥<text style="font-size: 33rpx;">{{ item.product.price.split('.')[0] }}.</text>{{item.product.price.split('.')[1]}} 限时特惠</view>
|
||||||
|
<view class="qiang" :class="{'no_qiang': !can_buy}">¥{{item.limited_price}} 抢</view>
|
||||||
|
<!-- <image src="@/static/images/icon/plus.png" style="width: 40rpx;height: 40rpx;border-radius: 40rpx;"></image> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="r_btn" v-if="item.product && item.product.price">
|
|
||||||
<view>¥<text style="font-size: 33rpx;">{{ item.product.price.split('.')[0] }}.</text>{{item.product.price.split('.')[1]}} 限时特惠</view>
|
|
||||||
<view class="qiang" :class="{'no_qiang': !can_buy}">抢</view>
|
|
||||||
<!-- <image src="@/static/images/icon/plus.png" style="width: 40rpx;height: 40rpx;border-radius: 40rpx;"></image> -->
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<image style="width: 100%;" mode="widthFix" src="/static/img/no_short.f2ffcd1c.png"></image>
|
||||||
|
<view style="text-align: center;color: #999;">此区域没有找到活动商品,切换其他地方试试呢</view>
|
||||||
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -47,7 +62,7 @@
|
|||||||
import authorize from "@/components/Authorize.vue";
|
import authorize from "@/components/Authorize.vue";
|
||||||
import { getUserInfo } from '@/api/user.js';
|
import { getUserInfo } from '@/api/user.js';
|
||||||
import shortPopupActive from "@/components/shortPopupActive.vue"
|
import shortPopupActive from "@/components/shortPopupActive.vue"
|
||||||
import { storeActivityProduct } from "@/api/activity.js"
|
import { storeActivityProduct, storeActivityDistrict } from "@/api/activity.js"
|
||||||
import {
|
import {
|
||||||
cloudWarehouse
|
cloudWarehouse
|
||||||
} from '@/api/requesta.js'
|
} from '@/api/requesta.js'
|
||||||
@ -75,24 +90,31 @@
|
|||||||
show: false,
|
show: false,
|
||||||
isAuto: false, //没有授权的不会自动授权
|
isAuto: false, //没有授权的不会自动授权
|
||||||
isShowAuth: false, //是否隐藏授权
|
isShowAuth: false, //是否隐藏授权
|
||||||
|
addressList: [],
|
||||||
goodsList: [],
|
goodsList: [],
|
||||||
street_id: '',
|
|
||||||
goodsNum: 0,
|
goodsNum: 0,
|
||||||
can_buy: 0, // 是否可以购买, 0不可以, 1可以
|
can_buy: 0, // 是否可以购买, 0不可以, 1可以
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.street_id = options.street_id;
|
this.address = {
|
||||||
|
street_id: options.street_id,
|
||||||
|
townName: options.townName
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getUserInfo();
|
this.getUserInfo();
|
||||||
this.loadList();
|
this.loadList();
|
||||||
this.cartFn();
|
this.cartFn();
|
||||||
this.address = this.$store.state.storage.address;
|
this.loadAddressList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeAddress(){
|
changeAddress(e){
|
||||||
|
this.address = {
|
||||||
|
street_id: this.addressList[e.detail.value].street_code,
|
||||||
|
townName: this.addressList[e.detail.value].street_name
|
||||||
|
}
|
||||||
|
this.loadList();
|
||||||
},
|
},
|
||||||
back() {
|
back() {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
@ -108,7 +130,7 @@
|
|||||||
let location = '';
|
let location = '';
|
||||||
if(this.$store.state.storage.location.lat) location = this.$store.state.storage.location.lat + ',' + this.$store.state.storage.location.long;
|
if(this.$store.state.storage.location.lat) location = this.$store.state.storage.location.lat + ',' + this.$store.state.storage.location.long;
|
||||||
storeActivityProduct({
|
storeActivityProduct({
|
||||||
street_code: this.$store.state.storage.address.street_id,
|
street_code: this.address.street_id,
|
||||||
activity_id: 2, //默认传2
|
activity_id: 2, //默认传2
|
||||||
location: location,
|
location: location,
|
||||||
source: 105
|
source: 105
|
||||||
@ -119,6 +141,14 @@
|
|||||||
Toast(e.msg||e.message||e)
|
Toast(e.msg||e.message||e)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
loadAddressList(){
|
||||||
|
storeActivityDistrict().then(res=>{
|
||||||
|
this.addressList = res.data;
|
||||||
|
if(!this.addressList.find(item=>item.street_code==this.address.street_id)){
|
||||||
|
this.address.street_id = ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
// 获取规格名称
|
// 获取规格名称
|
||||||
getSkuName(item){
|
getSkuName(item){
|
||||||
return Object.keys(item.sku).join('/')||null;
|
return Object.keys(item.sku).join('/')||null;
|
||||||
@ -229,8 +259,9 @@
|
|||||||
|
|
||||||
.r_name {
|
.r_name {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64rpx;
|
height: 80rpx;
|
||||||
line-height: 32rpx;
|
font-size: 28rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
display: -webkit-box; /* 使用弹性盒子布局 */
|
display: -webkit-box; /* 使用弹性盒子布局 */
|
||||||
-webkit-box-orient: vertical; /* 设置为垂直方向布局 */
|
-webkit-box-orient: vertical; /* 设置为垂直方向布局 */
|
||||||
@ -239,8 +270,8 @@
|
|||||||
.mer-labels{
|
.mer-labels{
|
||||||
background-color: #f84221;
|
background-color: #f84221;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 16rpx;
|
font-size: 18rpx;
|
||||||
padding: 2rpx 6rpx;
|
padding: 4rpx 8rpx;
|
||||||
border-radius: 5rpx;
|
border-radius: 5rpx;
|
||||||
margin-right: 8rpx;
|
margin-right: 8rpx;
|
||||||
}
|
}
|
||||||
@ -273,7 +304,7 @@
|
|||||||
padding-left: 15rpx;
|
padding-left: 15rpx;
|
||||||
border-radius: 0 60rpx 60rpx 0;
|
border-radius: 0 60rpx 60rpx 0;
|
||||||
.qiang{
|
.qiang{
|
||||||
width: 100rpx;
|
width: 160rpx;
|
||||||
height: 60rpx;
|
height: 60rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user