revert: 所有代码与custom/common分支同
This commit is contained in:
@@ -24,106 +24,116 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
uniGrid: () => import('@/components/uni-grid/uni-grid.vue'),
|
||||
uniGridItem: () => import('@/components/uni-grid-item/uni-grid-item.vue'),
|
||||
nsAdv: () => import('@/components/ns-adv/ns-adv.vue'),
|
||||
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
|
||||
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
||||
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
||||
nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'),
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
brandList: [],
|
||||
siteId: 0
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.site_id) this.siteId = options.site_id;
|
||||
},
|
||||
onShow() { },
|
||||
methods: {
|
||||
change(e) {
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
brand_id: this.brandList[e.detail.index].brand_id
|
||||
});
|
||||
import uniGrid from '@/components/uni-grid/uni-grid.vue';
|
||||
import uniGridItem from '@/components/uni-grid-item/uni-grid-item.vue';
|
||||
import nsAdv from '@/pages_tool/components/ns-adv/ns-adv.vue';
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
import nsLogin from '@/components/ns-login/ns-login.vue';
|
||||
import loadingCover from '@/components/loading-cover/loading-cover.vue';
|
||||
import nsEmpty from '@/components/ns-empty/ns-empty.vue';
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
uniGrid,
|
||||
uniGridItem,
|
||||
nsAdv,
|
||||
MescrollUni,
|
||||
nsLogin,
|
||||
loadingCover,
|
||||
nsEmpty,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
getBrandList(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/goodsbrand/page',
|
||||
data: {
|
||||
page_size: mescroll.size,
|
||||
page: mescroll.num,
|
||||
site_id: this.siteId
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
data() {
|
||||
return {
|
||||
brandList: [],
|
||||
siteId: 0
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.site_id) this.siteId = options.site_id;
|
||||
},
|
||||
onShow() {},
|
||||
methods: {
|
||||
change(e) {
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
brand_id: this.brandList[e.detail.index].brand_id
|
||||
});
|
||||
},
|
||||
getBrandList(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/goodsbrand/page',
|
||||
data: {
|
||||
page_size: mescroll.size,
|
||||
page: mescroll.num,
|
||||
site_id: this.siteId
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.brandList = []; //如果是第一页需手动制空列表
|
||||
this.brandList = this.brandList.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail() {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.brandList = []; //如果是第一页需手动制空列表
|
||||
this.brandList = this.brandList.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail() {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var title = '你想要的大牌都在这里';
|
||||
var path = '/pages_tool/goods/brand';
|
||||
return {
|
||||
title: title,
|
||||
path: path,
|
||||
success: res => {},
|
||||
fail: res => {}
|
||||
};
|
||||
}
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var title = '你想要的大牌都在这里';
|
||||
var path = '/pages_tool/goods/brand';
|
||||
return {
|
||||
title: title,
|
||||
path: path,
|
||||
success: res => { },
|
||||
fail: res => { }
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/deep/ .uni-grid-item {
|
||||
width: calc((100vw - (#{$margin-both} * 2)) / 3) !important;
|
||||
}
|
||||
|
||||
.adv-wrap {
|
||||
margin: $margin-updown $margin-both;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.brand-content {
|
||||
padding: $padding 0;
|
||||
box-sizing: border-box;
|
||||
background: #ffffff;
|
||||
margin: $margin-updown $margin-both 0;
|
||||
|
||||
.brand-pic {
|
||||
width: 60%;
|
||||
height: 50%;
|
||||
/deep/ .uni-grid-item {
|
||||
width: calc((100vw - (#{$margin-both} * 2)) / 3) !important;
|
||||
}
|
||||
|
||||
.brand_name {
|
||||
width: 70%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
.adv-wrap {
|
||||
margin: $margin-updown $margin-both;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.brand-content {
|
||||
padding: $padding 0;
|
||||
box-sizing: border-box;
|
||||
background: #ffffff;
|
||||
margin: $margin-updown $margin-both 0;
|
||||
|
||||
.brand-pic {
|
||||
width: 60%;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
.brand_name {
|
||||
width: 70%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -2,53 +2,42 @@
|
||||
<view :style="themeColor">
|
||||
<view class="cf-container color-line-border">
|
||||
<view class="tab">
|
||||
<view @click="changeSort(1)"><text
|
||||
:class="sort == 1 ? 'color-base-text active color-base-border-bottom' : ''">全部</text></view>
|
||||
<view @click="changeSort(2, 'reward')"><text
|
||||
:class="sort == 2 ? 'color-base-text active color-base-border-bottom' : ''">满减券</text></view>
|
||||
<view @click="changeSort(3, 'discount')"><text
|
||||
:class="sort == 3 ? 'color-base-text active color-base-border-bottom' : ''">折扣券</text></view>
|
||||
<!-- <view @click="changeSort(4, 'no_threshold')"><text :class="sort == 4 ? 'color-base-text active color-base-border-bottom' : ''">无门槛券</text></view> -->
|
||||
<view @click="changeSort(1)"><text :class="sort == 1 ? 'color-base-text active color-base-border-bottom' : ''">全部</text></view>
|
||||
<view @click="changeSort(2, 'reward')"><text :class="sort == 2 ? 'color-base-text active color-base-border-bottom' : ''">满减券</text></view>
|
||||
<view @click="changeSort(3, 'discount')"><text :class="sort == 3 ? 'color-base-text active color-base-border-bottom' : ''">折扣券</text></view>
|
||||
<!-- <view @click="changeSort(4, 'no_threshold')"><text :class="sort == 4 ? 'color-base-text active color-base-border-bottom' : ''">无门槛券</text></view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<mescroll-uni ref="mescroll" top="100" @getData="getMemberCouponList">
|
||||
<block slot="list">
|
||||
<view class="coupon-listone">
|
||||
<view class="item" v-for="(item, index) in list" :key="index" @click="liClick(item, index)"
|
||||
:style="{ backgroundColor: item.useState == 2 ? '#F2F2F2' : 'var(--main-color-shallow)' }">
|
||||
<view class="item" v-for="(item, index) in list" :key="index" @click="liClick(item, index)" :style="{ backgroundColor: item.useState == 2 ? '#F2F2F2' : 'var(--main-color-shallow)' }">
|
||||
<view class="item-base" :class="{ disabled: item.useState == 2 }">
|
||||
<image class="coupon-line" mode="heightFix"
|
||||
:src="$util.img('public/uniapp/coupon/coupon_line.png')"></image>
|
||||
<image class="coupon-line" mode="heightFix" :src="$util.img('public/uniapp/coupon/coupon_line.png')"></image>
|
||||
<view>
|
||||
<view class="use_price price-font" v-if="item.type == 'reward'"
|
||||
:class="{ disabled: item.useState == 2 }">
|
||||
<view class="use_price price-font" v-if="item.type == 'reward'" :class="{ disabled: item.useState == 2 }">
|
||||
<text>¥</text>
|
||||
{{ parseFloat(item.money) }}
|
||||
</view>
|
||||
<view class="use_price price-font" v-else-if="item.type == 'discount'"
|
||||
:class="{ disabled: item.useState == 2 }">
|
||||
<view class="use_price price-font" v-else-if="item.type == 'discount'" :class="{ disabled: item.useState == 2 }">
|
||||
{{ parseFloat(item.discount) }}
|
||||
<text>折</text>
|
||||
</view>
|
||||
<view class="use_condition font-size-tag" v-if="item.at_least > 0"
|
||||
:class="{ disabled: item.useState == 2 }">满{{ item.at_least }}元可用</view>
|
||||
<view class="use_condition font-size-tag" v-else
|
||||
:class="{ disabled: item.useState == 2 }">无门槛优惠券</view>
|
||||
<view class="use_condition font-size-tag" v-if="item.at_least > 0" :class="{ disabled: item.useState == 2 }">满{{ item.at_least }}元可用</view>
|
||||
<view class="use_condition font-size-tag" v-else :class="{ disabled: item.useState == 2 }">无门槛优惠券</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-info">
|
||||
<view class="use_title">
|
||||
<view class="title">{{ item.coupon_name }}</view>
|
||||
<view class="max_price" v-if="item.goods_type == 2 || item.goods_type == 3"
|
||||
:class="{ disabled: item.useState == 2 }">指定商品</view>
|
||||
<view class="max_price" v-if="item.goods_type == 2 || item.goods_type == 3" :class="{ disabled: item.useState == 2 }">指定商品</view>
|
||||
<view class="max_price" v-else :class="{ disabled: item.useState == 2 }">全场商品</view>
|
||||
<view class="max_price" v-if="item.discount_limit != '0.00'">
|
||||
(最大优惠{{ item.discount_limit }}元)
|
||||
</view>
|
||||
<view class="max_price" :class="{ disabled: item.useState == 2 }">{{
|
||||
item.use_channel_name }}</view>
|
||||
<!-- <view class="max_price truncate" v-if="item.use_channel!='online'" :class="{ disabled: item.useState == 2 }">
|
||||
<view class="max_price" :class="{ disabled: item.useState == 2 }">{{ item.use_channel_name }}</view>
|
||||
<!-- <view class="max_price truncate" v-if="item.use_channel!='online'" :class="{ disabled: item.useState == 2 }">
|
||||
{{ item.use_store==='all'?'适用门店:全部门店': '适用门店:'+item.use_store_name}}
|
||||
</view> -->
|
||||
</view>
|
||||
@@ -81,401 +70,406 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
|
||||
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
||||
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
||||
nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'),
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
sort: 1,
|
||||
types: '',
|
||||
couponBtnSwitch: false,
|
||||
//分享建立上下级id
|
||||
mpShareData: null //小程序分享数据
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
setTimeout(() => {
|
||||
if (!this.addonIsExist.coupon) {
|
||||
this.$util.showToast({
|
||||
title: '商家未开启优惠券',
|
||||
mask: true,
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
//小程序分享接收source_member
|
||||
if (option.source_member) {
|
||||
uni.setStorageSync('source_member', option.source_member);
|
||||
}
|
||||
// 小程序扫码进入,接收source_member
|
||||
if (option.scene) {
|
||||
var sceneParams = decodeURIComponent(option.scene);
|
||||
sceneParams = sceneParams.split('&');
|
||||
if (sceneParams.length) {
|
||||
sceneParams.forEach(item => {
|
||||
if (item.indexOf('sku_id') != -1) this.skuId = item.split('-')[1];
|
||||
if (item.indexOf('m') != -1) uni.setStorageSync('source_member', item.split('-')[1]);
|
||||
if (item.indexOf('is_test') != -1) uni.setStorageSync('is_test', 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
//记录分享关系
|
||||
if (this.storeToken && uni.getStorageSync('source_member')) {
|
||||
this.$util.onSourceMember(uni.getStorageSync('source_member'));
|
||||
}
|
||||
|
||||
//小程序分享
|
||||
// #ifdef MP-WEIXIN
|
||||
this.$util.getMpShare().then(res => {
|
||||
this.mpShareData = res;
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
//分享给好友
|
||||
onShareAppMessage() {
|
||||
return this.mpShareData.appMessage;
|
||||
},
|
||||
//分享到朋友圈
|
||||
onShareTimeline() {
|
||||
return this.mpShareData.timeLine;
|
||||
},
|
||||
methods: {
|
||||
changeSort(sort, types) {
|
||||
this.list = [];
|
||||
this.sort = sort;
|
||||
this.types = types;
|
||||
this.$refs.mescroll.refresh(false);
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
import nsLogin from '@/components/ns-login/ns-login.vue';
|
||||
import loadingCover from '@/components/loading-cover/loading-cover.vue';
|
||||
import nsEmpty from '@/components/ns-empty/ns-empty.vue';
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
nsLogin,
|
||||
loadingCover,
|
||||
nsEmpty,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
liClick(item, index) {
|
||||
if (['limit', 'expire', 'out'].includes(item.receivedType)) return false;
|
||||
if (item.useState == 0) this.receiveCoupon(item, index);
|
||||
else this.toGoodsList(item, index);
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
sort: 1,
|
||||
types: '',
|
||||
couponBtnSwitch: false,
|
||||
//分享建立上下级id
|
||||
mpShareData: null //小程序分享数据
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
setTimeout( () => {
|
||||
if (!this.addonIsExist.coupon) {
|
||||
this.$util.showToast({
|
||||
title: '商家未开启优惠券',
|
||||
mask: true,
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
}, 2000);
|
||||
}
|
||||
},1000);
|
||||
|
||||
//小程序分享接收source_member
|
||||
if (option.source_member) {
|
||||
uni.setStorageSync('source_member', option.source_member);
|
||||
}
|
||||
// 小程序扫码进入,接收source_member
|
||||
if (option.scene) {
|
||||
var sceneParams = decodeURIComponent(option.scene);
|
||||
sceneParams = sceneParams.split('&');
|
||||
if (sceneParams.length) {
|
||||
sceneParams.forEach(item => {
|
||||
if (item.indexOf('sku_id') != -1) this.skuId = item.split('-')[1];
|
||||
if (item.indexOf('m') != -1) uni.setStorageSync('source_member', item.split('-')[1]);
|
||||
if (item.indexOf('is_test') != -1) uni.setStorageSync('is_test', 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
//记录分享关系
|
||||
if (this.storeToken && uni.getStorageSync('source_member')) {
|
||||
this.$util.onSourceMember(uni.getStorageSync('source_member'));
|
||||
}
|
||||
|
||||
//领取优惠券
|
||||
receiveCoupon(item, index) {
|
||||
if (this.couponBtnSwitch) return;
|
||||
this.couponBtnSwitch = true;
|
||||
if (this.storeToken) {
|
||||
//小程序分享
|
||||
// #ifdef MP-WEIXIN
|
||||
this.$util.getMpShare().then(res => {
|
||||
this.mpShareData = res;
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
//分享给好友
|
||||
onShareAppMessage() {
|
||||
return this.mpShareData.appMessage;
|
||||
},
|
||||
//分享到朋友圈
|
||||
onShareTimeline() {
|
||||
return this.mpShareData.timeLine;
|
||||
},
|
||||
methods: {
|
||||
changeSort(sort, types) {
|
||||
this.list = [];
|
||||
this.sort = sort;
|
||||
this.types = types;
|
||||
this.$refs.mescroll.refresh(false);
|
||||
},
|
||||
liClick(item, index) {
|
||||
if(['limit', 'expire', 'out'].includes(item.receivedType)) return false;
|
||||
if (item.useState == 0) this.receiveCoupon(item, index);
|
||||
else this.toGoodsList(item, index);
|
||||
},
|
||||
|
||||
//领取优惠券
|
||||
receiveCoupon(item, index) {
|
||||
if (this.couponBtnSwitch) return;
|
||||
this.couponBtnSwitch = true;
|
||||
if (this.storeToken) {
|
||||
this.$api.sendRequest({
|
||||
url: '/coupon/api/coupon/receive',
|
||||
data: {
|
||||
coupon_type_id: item.coupon_type_id,
|
||||
get_type: 2 //获取方式:1订单2.直接领取3.活动领取
|
||||
},
|
||||
success: res => {
|
||||
this.couponBtnSwitch = false;
|
||||
let msg = '领取成功,快去使用吧';
|
||||
let list = this.list;
|
||||
if (res.code < 0) msg = res.message;
|
||||
|
||||
if (res.data.is_exist == 1) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].coupon_type_id == item.coupon_type_id) {
|
||||
list[i].useState = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].coupon_type_id == item.coupon_type_id) {
|
||||
list[i].receivedType = res.data.type;
|
||||
list[i].useState = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
},
|
||||
fail: res => {
|
||||
this.couponBtnSwitch = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.couponBtnSwitch = false;
|
||||
this.$refs.login.open('/pages_tool/goods/coupon');
|
||||
}
|
||||
},
|
||||
//获取优惠券列表
|
||||
getMemberCouponList(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/coupon/api/coupon/receive',
|
||||
url: '/coupon/api/coupon/typepagelists',
|
||||
data: {
|
||||
coupon_type_id: item.coupon_type_id,
|
||||
get_type: 2 //获取方式:1订单2.直接领取3.活动领取
|
||||
page: mescroll.num,
|
||||
page_size: mescroll.size,
|
||||
sort: this.sort,
|
||||
type: this.types
|
||||
},
|
||||
success: res => {
|
||||
this.couponBtnSwitch = false;
|
||||
let msg = '领取成功,快去使用吧';
|
||||
let list = this.list;
|
||||
if (res.code < 0) msg = res.message;
|
||||
|
||||
if (res.data.is_exist == 1) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].coupon_type_id == item.coupon_type_id) {
|
||||
list[i].useState = 1;
|
||||
}
|
||||
}
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].coupon_type_id == item.coupon_type_id) {
|
||||
list[i].receivedType = res.data.type;
|
||||
list[i].useState = 2;
|
||||
}
|
||||
}
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
mescroll.endSuccess(newArr.length);
|
||||
if (newArr.length) {
|
||||
newArr.forEach(v => {
|
||||
if (v.count == v.lead_count) v.useState = 2;
|
||||
else if (v.max_fetch != 0 && v.member_coupon_num && v.member_coupon_num >= v.max_fetch) v.useState = 1;
|
||||
else v.useState = 0;
|
||||
});
|
||||
}
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
|
||||
this.list = this.list.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail: res => {
|
||||
this.couponBtnSwitch = false;
|
||||
fail() {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.couponBtnSwitch = false;
|
||||
this.$refs.login.open('/pages_tool/goods/coupon');
|
||||
}
|
||||
},
|
||||
//获取优惠券列表
|
||||
getMemberCouponList(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/coupon/api/coupon/typepagelists',
|
||||
data: {
|
||||
page: mescroll.num,
|
||||
page_size: mescroll.size,
|
||||
sort: this.sort,
|
||||
type: this.types
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
if (newArr.length) {
|
||||
newArr.forEach(v => {
|
||||
if (v.count == v.lead_count) v.useState = 2;
|
||||
else if (v.max_fetch != 0 && v.member_coupon_num && v.member_coupon_num >= v.max_fetch) v.useState = 1;
|
||||
else v.useState = 0;
|
||||
});
|
||||
}
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
|
||||
this.list = this.list.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail() {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
imageError(index) {
|
||||
this.list[index].logo = this.$util.getDefaultImage().goods;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
couponImageError(index) {
|
||||
this.list[index].image = this.$util.img('public/uniapp/goods/coupon.png');
|
||||
this.$forceUpdate();
|
||||
},
|
||||
toGoodsList(item) {
|
||||
if (item.goods_type != 1) {
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
coupon: item.coupon_type_id
|
||||
});
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_goods/list', {});
|
||||
}
|
||||
});
|
||||
},
|
||||
imageError(index) {
|
||||
this.list[index].logo = this.$util.getDefaultImage().goods;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
couponImageError(index) {
|
||||
this.list[index].image = this.$util.img('public/uniapp/goods/coupon.png');
|
||||
this.$forceUpdate();
|
||||
},
|
||||
toGoodsList(item) {
|
||||
if (item.goods_type != 1) {
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
coupon: item.coupon_type_id
|
||||
});
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_goods/list', {});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.coupon-head {
|
||||
padding: 20rpx 50rpx;
|
||||
display: flex;
|
||||
background: #fff;
|
||||
|
||||
.sort {
|
||||
border: 2rpx solid #c5c5c5;
|
||||
padding: 1rpx 20rpx;
|
||||
border-radius: $border-radius;
|
||||
cursor: pointer;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.coupon-listone {
|
||||
padding: 0 30rpx;
|
||||
|
||||
.item {
|
||||
.coupon-head {
|
||||
padding: 20rpx 50rpx;
|
||||
display: flex;
|
||||
background-color: #fff2f0;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 20rpx;
|
||||
align-items: stretch;
|
||||
margin-top: $padding;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
|
||||
.item-base {
|
||||
position: relative;
|
||||
width: 197rpx;
|
||||
min-width: 197rpx;
|
||||
text-align: center;
|
||||
background: linear-gradient(to left, var(--bg-color), var(--bg-color-shallow));
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
padding: 38rpx 10rpx 38rpx 18rpx;
|
||||
|
||||
&.disabled {
|
||||
background: #dedede;
|
||||
}
|
||||
|
||||
.coupon-line {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
>view {
|
||||
height: auto;
|
||||
position: relative;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
|
||||
.use_price {
|
||||
font-size: 60rpx;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
|
||||
text {
|
||||
font-size: $font-size-toolbar;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: $color-tip;
|
||||
}
|
||||
}
|
||||
|
||||
.use_condition {
|
||||
color: #fff;
|
||||
margin-top: $padding;
|
||||
|
||||
&.margin_top_none {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: $color-tip;
|
||||
}
|
||||
}
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
background-color: #f8f8f8;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
height: 30rpx;
|
||||
width: 15rpx;
|
||||
border-radius: 0 30rpx 30rpx 0;
|
||||
}
|
||||
.sort {
|
||||
border: 2rpx solid #c5c5c5;
|
||||
padding: 1rpx 20rpx;
|
||||
border-radius: $border-radius;
|
||||
cursor: pointer;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item-btn {
|
||||
width: 160rpx;
|
||||
min-width: 160rpx;
|
||||
align-self: center;
|
||||
position: relative;
|
||||
.coupon-listone {
|
||||
padding: 0 30rpx;
|
||||
|
||||
view {
|
||||
width: 100rpx;
|
||||
height: 50rpx;
|
||||
border-radius: $border-radius;
|
||||
line-height: 50rpx;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
background-image: linear-gradient(to right, var(--bg-color), var(--bg-color-shallow));
|
||||
color: var(--btn-text-color);
|
||||
font-size: $font-size-tag;
|
||||
|
||||
&.disabled {
|
||||
background: #dedede !important;
|
||||
color: #909399 !important;
|
||||
}
|
||||
}
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
background-color: #f8f8f8;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
height: 30rpx;
|
||||
width: 15rpx;
|
||||
border-radius: 30rpx 0 0 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item-info {
|
||||
flex: 1;
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin-left: 20rpx;
|
||||
background-color: #fff2f0;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 20rpx;
|
||||
align-items: stretch;
|
||||
margin-top: $padding;
|
||||
overflow: hidden;
|
||||
background-repeat-x: no-repeat;
|
||||
background-repeat-y: repeat;
|
||||
|
||||
.use_time {
|
||||
padding: 20rpx 0;
|
||||
border-top: 2rpx dashed #cccccc;
|
||||
font-size: $font-size-activity-tag;
|
||||
color: #909399;
|
||||
}
|
||||
.item-base {
|
||||
position: relative;
|
||||
width: 197rpx;
|
||||
min-width: 197rpx;
|
||||
text-align: center;
|
||||
background: linear-gradient(to left, var(--bg-color), var(--bg-color-shallow));
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
padding: 38rpx 10rpx 38rpx 18rpx;
|
||||
|
||||
.use_title {
|
||||
font-size: $font-size-base;
|
||||
font-weight: 500;
|
||||
padding: 20rpx 0;
|
||||
|
||||
// height:80rpx;
|
||||
.title {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
&.disabled {
|
||||
background: #dedede;
|
||||
}
|
||||
|
||||
.max_price {
|
||||
font-weight: 400;
|
||||
.coupon-line {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
>view {
|
||||
height: auto;
|
||||
position: relative;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
|
||||
.use_price {
|
||||
font-size: 60rpx;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
|
||||
text {
|
||||
font-size: $font-size-toolbar;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: $color-tip;
|
||||
}
|
||||
}
|
||||
|
||||
.use_condition {
|
||||
color: #fff;
|
||||
margin-top: $padding;
|
||||
|
||||
&.margin_top_none {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: $color-tip;
|
||||
}
|
||||
}
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
background-color: #f8f8f8;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
height: 30rpx;
|
||||
width: 15rpx;
|
||||
border-radius: 0 30rpx 30rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
.item-btn {
|
||||
width: 160rpx;
|
||||
min-width: 160rpx;
|
||||
align-self: center;
|
||||
position: relative;
|
||||
|
||||
view {
|
||||
width: 100rpx;
|
||||
height: 50rpx;
|
||||
border-radius: $border-radius;
|
||||
line-height: 50rpx;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
background-image: linear-gradient(to right, var(--bg-color), var(--bg-color-shallow));
|
||||
color: var(--btn-text-color);
|
||||
font-size: $font-size-tag;
|
||||
|
||||
&.disabled {
|
||||
background: #dedede !important;
|
||||
color: #909399 !important;
|
||||
}
|
||||
}
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
background-color: #f8f8f8;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
height: 30rpx;
|
||||
width: 15rpx;
|
||||
border-radius: 30rpx 0 0 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin-left: 20rpx;
|
||||
overflow: hidden;
|
||||
background-repeat-x: no-repeat;
|
||||
background-repeat-y: repeat;
|
||||
|
||||
.use_time {
|
||||
padding: 20rpx 0;
|
||||
border-top: 2rpx dashed #cccccc;
|
||||
font-size: $font-size-activity-tag;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.use_title {
|
||||
font-size: $font-size-base;
|
||||
font-weight: 500;
|
||||
padding: 20rpx 0;
|
||||
|
||||
// height:80rpx;
|
||||
.title {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.max_price {
|
||||
font-weight: 400;
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.empty {
|
||||
margin-top: 200rpx;
|
||||
}
|
||||
.empty {
|
||||
margin-top: 200rpx;
|
||||
}
|
||||
|
||||
.cf-container {
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
.cf-container {
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tab {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 86rpx;
|
||||
|
||||
>view {
|
||||
text-align: center;
|
||||
width: 33%;
|
||||
.tab {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 86rpx;
|
||||
|
||||
text {
|
||||
display: inline-block;
|
||||
line-height: 86rpx;
|
||||
height: 80rpx;
|
||||
font-size: 30rpx;
|
||||
>view {
|
||||
text-align: center;
|
||||
width: 33%;
|
||||
height: 86rpx;
|
||||
|
||||
text {
|
||||
display: inline-block;
|
||||
line-height: 86rpx;
|
||||
height: 80rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.active {
|
||||
border-bottom: 4rpx solid;
|
||||
}
|
||||
|
||||
.truncate {
|
||||
overflow: hidden;
|
||||
-o-text-overflow: ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.active {
|
||||
border-bottom: 4rpx solid;
|
||||
}
|
||||
.truncate {
|
||||
overflow: hidden;
|
||||
-o-text-overflow: ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
@@ -39,13 +39,6 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
||||
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
info: {},
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</view>
|
||||
<text class="evaluator-name using-hidden" v-else>{{ item.member_name }}</text>
|
||||
<view class="evaluator-time color-tip">{{ $util.timeStampTurnTime(item.create_time)
|
||||
}}</view>
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="evaluator-xing">
|
||||
<xiaoStarComponent :starCount="item.scores * 2"></xiaoStarComponent>
|
||||
@@ -74,16 +74,24 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
import nsLogin from '@/components/ns-login/ns-login.vue';
|
||||
import loadingCover from '@/components/loading-cover/loading-cover.vue';
|
||||
import nsEmpty from '@/components/ns-empty/ns-empty.vue';
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
|
||||
import xiaoStarComponent from '@/components/xiao-star-component/xiao-star-component.vue';
|
||||
export default {
|
||||
components: {
|
||||
xiaoStarComponent: () => import('@/components/xiao-star-component/xiao-star-component.vue'),
|
||||
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
|
||||
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
||||
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
||||
nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'),
|
||||
xiaoStarComponent,
|
||||
MescrollUni,
|
||||
nsLogin,
|
||||
loadingCover,
|
||||
nsEmpty,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -12,17 +12,16 @@ export default {
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
onShow() { },
|
||||
onShow() {},
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page {
|
||||
.page{
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.closeBox {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -31,11 +30,9 @@ export default {
|
||||
align-items: center;
|
||||
margin-top: 260rpx;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 400rpx;
|
||||
}
|
||||
|
||||
.close-title {
|
||||
font-size: $font-size-base;
|
||||
color: $color-tip;
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
<view class="content">
|
||||
<view class="cate-search">
|
||||
<view class="search-box" @click="search()" @tap.stop="search()">
|
||||
<input class="uni-input" maxlength="50" v-model="inputValue" confirm-type="search"
|
||||
@focus="inputFocus" focus @confirm="search()" @click="search()" @tap="search()"
|
||||
:placeholder="searchWords ? searchWords : ''" />
|
||||
<input class="uni-input" maxlength="50" v-model="inputValue" confirm-type="search" @focus="inputFocus" focus @confirm="search()" @click="search()" @tap="search()" :placeholder="searchWords ? searchWords : ''" />
|
||||
<text class="iconfont icon-sousuo3" @click="search()"></text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -17,10 +15,8 @@
|
||||
<view class="title">历史搜索</view>
|
||||
<view class="icon iconfont icon-icon7" @click="deleteHistoryList"></view>
|
||||
</view>
|
||||
<view class="history-bottom " id="history-list"
|
||||
:style="{ maxHeight: !isAllHistory ? '100%' : '168rpx' }">
|
||||
<view class="history-li" v-for="(item, index) in historyList" :key="index"
|
||||
@click="otherSearch(item)">
|
||||
<view class="history-bottom " id="history-list" :style="{ maxHeight: !isAllHistory ? '100%' : '168rpx' }">
|
||||
<view class="history-li" v-for="(item, index) in historyList" :key="index" @click="otherSearch(item)">
|
||||
<view>{{ item }}</view>
|
||||
</view>
|
||||
<view class="history-li history_more" v-if="isAllHistory" @click="isAllHistory = false">
|
||||
@@ -37,8 +33,7 @@
|
||||
<view class="title">热门搜索</view>
|
||||
</view>
|
||||
<view class="history-bottom">
|
||||
<view class="history-li" v-for="(item, index) in hotList" :key="index"
|
||||
@click="otherSearch(item)" @longtap="deleteItem(item)">
|
||||
<view class="history-li" v-for="(item, index) in hotList" :key="index" @click="otherSearch(item)" @longtap="deleteItem(item)">
|
||||
<view>{{ item }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -50,297 +45,297 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
inputValue: '', //搜索框的值
|
||||
historyList: [], //历史搜索记录
|
||||
searchList: [], //搜索发现列表
|
||||
alikeList: [],
|
||||
isIndex: false,
|
||||
searchWords: '',
|
||||
hotList: [],
|
||||
isAllHistory: false
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.keyword) this.inputValue = options.keyword;
|
||||
uni.getStorageSync('search') ? '' : uni.setStorageSync('search', []);
|
||||
},
|
||||
onShow() {
|
||||
this.findHistoryList();
|
||||
this.defaultSearch();
|
||||
this.findHotList();
|
||||
this.$nextTick(function () {
|
||||
this.getHistoryHeight();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
//获取历史搜索记录
|
||||
findHistoryList() {
|
||||
this.historyList = uni.getStorageSync('search').reverse();
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
inputValue: '', //搜索框的值
|
||||
historyList: [], //历史搜索记录
|
||||
searchList: [], //搜索发现列表
|
||||
alikeList: [],
|
||||
isIndex: false,
|
||||
searchWords: '',
|
||||
hotList: [],
|
||||
isAllHistory: false
|
||||
};
|
||||
},
|
||||
//删除所有历史记录
|
||||
deleteHistoryList() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认删除全部历史记录?',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
uni.setStorageSync('search', []);
|
||||
this.findHistoryList();
|
||||
onLoad(options) {
|
||||
if (options.keyword) this.inputValue = options.keyword;
|
||||
uni.getStorageSync('search') ? '' : uni.setStorageSync('search', []);
|
||||
},
|
||||
onShow() {
|
||||
this.findHistoryList();
|
||||
this.defaultSearch();
|
||||
this.findHotList();
|
||||
this.$nextTick(function() {
|
||||
this.getHistoryHeight();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
//获取历史搜索记录
|
||||
findHistoryList() {
|
||||
this.historyList = uni.getStorageSync('search').reverse();
|
||||
},
|
||||
//删除所有历史记录
|
||||
deleteHistoryList() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认删除全部历史记录?',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
uni.setStorageSync('search', []);
|
||||
this.findHistoryList();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//删除历史记录的某一项
|
||||
deleteItem(e) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认删除该条历史记录?',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
let array = uni.getStorageSync('search');
|
||||
let newArr = array.filter(v => {
|
||||
return v != e;
|
||||
});
|
||||
uni.setStorageSync('search', newArr);
|
||||
this.findHistoryList();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取默认搜素
|
||||
defaultSearch() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/goods/defaultSearchWords',
|
||||
success: res => {
|
||||
this.searchWords = res.data.words;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取热门搜素
|
||||
findHotList() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/goods/hotSearchWords',
|
||||
success: res => {
|
||||
if (res.data.words != '') {
|
||||
this.hotList = res.data.words.split(',');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//input框获取焦点事件
|
||||
inputFocus(e) {
|
||||
if (this.inputValue.trim() != '') this.dataList = [];
|
||||
},
|
||||
//点击其他列表搜索
|
||||
otherSearch(e) {
|
||||
this.inputValue = e;
|
||||
this.search();
|
||||
},
|
||||
//搜索
|
||||
search() {
|
||||
|
||||
if (this.inputValue.trim() != '') {
|
||||
|
||||
// 对历史搜索处理,判断有无,最近搜索显示在最前
|
||||
let historyList = uni.getStorageSync('search');
|
||||
let array = [];
|
||||
if (historyList.length) {
|
||||
array = historyList.filter(v => {
|
||||
return v != this.inputValue.trim();
|
||||
});
|
||||
array.push(this.inputValue.trim());
|
||||
} else {
|
||||
array.push(this.inputValue.trim());
|
||||
}
|
||||
uni.setStorageSync('search', array);
|
||||
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
keyword: this.inputValue.trim()
|
||||
});
|
||||
} else {
|
||||
if (this.searchWords == '') {
|
||||
this.$util.showToast({
|
||||
title: '搜索内容不能为空哦'
|
||||
},
|
||||
//删除历史记录的某一项
|
||||
deleteItem(e) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认删除该条历史记录?',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
let array = uni.getStorageSync('search');
|
||||
let newArr = array.filter(v => {
|
||||
return v != e;
|
||||
});
|
||||
uni.setStorageSync('search', newArr);
|
||||
this.findHistoryList();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取默认搜素
|
||||
defaultSearch() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/goods/defaultSearchWords',
|
||||
success: res => {
|
||||
this.searchWords = res.data.words;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取热门搜素
|
||||
findHotList() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/goods/hotSearchWords',
|
||||
success: res => {
|
||||
if (res.data.words != '') {
|
||||
this.hotList = res.data.words.split(',');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//input框获取焦点事件
|
||||
inputFocus(e) {
|
||||
if (this.inputValue.trim() != '') this.dataList = [];
|
||||
},
|
||||
//点击其他列表搜索
|
||||
otherSearch(e) {
|
||||
this.inputValue = e;
|
||||
this.search();
|
||||
},
|
||||
//搜索
|
||||
search() {
|
||||
|
||||
if (this.inputValue.trim() != '') {
|
||||
|
||||
// 对历史搜索处理,判断有无,最近搜索显示在最前
|
||||
let historyList = uni.getStorageSync('search');
|
||||
let array = [];
|
||||
if (historyList.length) {
|
||||
array = historyList.filter(v => {
|
||||
return v != this.inputValue.trim();
|
||||
});
|
||||
array.push(this.inputValue.trim());
|
||||
} else {
|
||||
array.push(this.inputValue.trim());
|
||||
}
|
||||
uni.setStorageSync('search', array);
|
||||
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
keyword: this.inputValue.trim()
|
||||
});
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
//keyword: this.searchWords
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
// 获取元素高度
|
||||
getHistoryHeight() {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('#history-list')
|
||||
.boundingClientRect(data => {
|
||||
if (data && data.height > uni.upx2px(70) * 2 + uni.upx2px(35) * 2) {
|
||||
this.isAllHistory = true;
|
||||
if (this.searchWords == '') {
|
||||
this.$util.showToast({
|
||||
title: '搜索内容不能为空哦'
|
||||
});
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
//keyword: this.searchWords
|
||||
});
|
||||
}
|
||||
}).exec();
|
||||
}
|
||||
},
|
||||
// 获取元素高度
|
||||
getHistoryHeight() {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('#history-list')
|
||||
.boundingClientRect(data => {
|
||||
if (data && data.height > uni.upx2px(70) * 2 + uni.upx2px(35) * 2) {
|
||||
this.isAllHistory = true;
|
||||
}
|
||||
}).exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/deep/ .fixed {
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/deep/ .empty {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
.cart-empty {
|
||||
padding-top: 54px;
|
||||
}
|
||||
|
||||
.content {
|
||||
// overflow: hidden;
|
||||
width: 100vw;
|
||||
/* #ifdef MP */
|
||||
height: 100vh;
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
height: calc(100vh - env(safe-area-inset-bottom) - var(--status-bar-height));
|
||||
/* #endif */
|
||||
/* #ifdef APP-PLUS */
|
||||
height: calc(100vh - 44px - env(safe-area-inset-bottom));
|
||||
/* #endif */
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.cate-search {
|
||||
width: 100%;
|
||||
background: #ffffff;
|
||||
padding: 10rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
/* #ifdef H5 */
|
||||
padding-top: 30rpx;
|
||||
/* #endif */
|
||||
|
||||
input {
|
||||
font-size: $font-size-base;
|
||||
height: 100%;
|
||||
padding: 0 25rpx 0 30rpx;
|
||||
width: calc(100% - 120rpx);
|
||||
/deep/ .fixed {
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 32rpx;
|
||||
color: $color-tip;
|
||||
width: 120rpx;
|
||||
text-align: center;
|
||||
/deep/ .empty {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
width: 100%;
|
||||
height: 64rpx;
|
||||
background: $color-bg;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 40rpx;
|
||||
.cart-empty {
|
||||
padding-top: 54px;
|
||||
}
|
||||
}
|
||||
|
||||
.search-content {
|
||||
box-sizing: border-box;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.history {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.history-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.content {
|
||||
// overflow: hidden;
|
||||
width: 100vw;
|
||||
/* #ifdef MP */
|
||||
height: 100vh;
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
height: calc(100vh - env(safe-area-inset-bottom) - var(--status-bar-height));
|
||||
/* #endif */
|
||||
/* #ifdef APP-PLUS */
|
||||
height: calc(100vh - 44px - env(safe-area-inset-bottom));
|
||||
/* #endif */
|
||||
background: #ffffff;
|
||||
padding: 30rpx 30rpx 0rpx 30rpx;
|
||||
}
|
||||
|
||||
.cate-search {
|
||||
width: 100%;
|
||||
background: #ffffff;
|
||||
padding: 10rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
/* #ifdef H5 */
|
||||
padding-top: 30rpx;
|
||||
/* #endif */
|
||||
|
||||
.history-top {
|
||||
input {
|
||||
font-size: $font-size-base;
|
||||
height: 100%;
|
||||
padding: 0 25rpx 0 30rpx;
|
||||
width: calc(100% - 120rpx);
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 32rpx;
|
||||
color: $color-tip;
|
||||
width: 120rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
width: 100%;
|
||||
height: 60rpx;
|
||||
height: 64rpx;
|
||||
background: $color-bg;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: $font-size-toolbar;
|
||||
|
||||
.title {
|
||||
font-weight: 500;
|
||||
font-size: $font-size-toolbar;
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
color: $color-tip;
|
||||
font-size: $font-size-base;
|
||||
}
|
||||
}
|
||||
|
||||
.history-bottom {
|
||||
width: 100%;
|
||||
padding-top: $padding;
|
||||
position: relative;
|
||||
|
||||
.history-li {
|
||||
display: inline-block;
|
||||
margin-right: 20rpx;
|
||||
margin-bottom: 15rpx;
|
||||
max-width: 100%;
|
||||
|
||||
view {
|
||||
line-height: 66rpx;
|
||||
background: #f8f8f8 !important;
|
||||
height: 66rpx;
|
||||
color: #303133 !important;
|
||||
margin: 0 0rpx 4rpx 0 !important;
|
||||
padding: 0 $padding;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
&.history_more {
|
||||
margin-right: 0;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.hidden-show {
|
||||
width: 100%;
|
||||
height: 70rpx;
|
||||
text-align: center;
|
||||
line-height: 70rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.search-alike {
|
||||
width: 100%;
|
||||
height: calc(100vh - 100rpx);
|
||||
|
||||
padding: 0 $padding;
|
||||
box-sizing: border-box;
|
||||
|
||||
.alike-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.search-content {
|
||||
box-sizing: border-box;
|
||||
background: #ffffff;
|
||||
border-radius: $padding;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.history {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.history-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #ffffff;
|
||||
padding: 30rpx 30rpx 0rpx 30rpx;
|
||||
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
|
||||
.history-top {
|
||||
width: 100%;
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: $font-size-toolbar;
|
||||
|
||||
.title {
|
||||
font-weight: 500;
|
||||
font-size: $font-size-toolbar;
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
color: $color-tip;
|
||||
font-size: $font-size-base;
|
||||
}
|
||||
}
|
||||
|
||||
.history-bottom {
|
||||
width: 100%;
|
||||
padding-top: $padding;
|
||||
position: relative;
|
||||
|
||||
.history-li {
|
||||
display: inline-block;
|
||||
margin-right: 20rpx;
|
||||
margin-bottom: 15rpx;
|
||||
max-width: 100%;
|
||||
|
||||
view {
|
||||
line-height: 66rpx;
|
||||
background: #f8f8f8 !important;
|
||||
height: 66rpx;
|
||||
color: #303133 !important;
|
||||
margin: 0 0rpx 4rpx 0 !important;
|
||||
padding: 0 $padding;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
&.history_more {
|
||||
margin-right: 0;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hidden-show {
|
||||
width: 100%;
|
||||
height: 70rpx;
|
||||
text-align: center;
|
||||
line-height: 70rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.search-alike {
|
||||
width: 100%;
|
||||
height: calc(100vh - 100rpx);
|
||||
|
||||
padding: 0 $padding;
|
||||
box-sizing: border-box;
|
||||
|
||||
.alike-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #ffffff;
|
||||
border-radius: $padding;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user