|
@@ -2,10 +2,29 @@
|
|
|
<view>
|
|
|
<view style="background-color: #E75F37;padding: 20rpx;">
|
|
|
<u-search placeholder="请输入商品名称" bgColor="#fff" searchIconColor='#E75F37' :actionStyle="{color:'#FFF'}"
|
|
|
- :searchIconSize='24' v-model="name" @click="inSearch" disabled @custom="inSearch()"></u-search>
|
|
|
+ :searchIconSize='24' v-model="name" @search="custom()" @custom="custom()"></u-search>
|
|
|
</view>
|
|
|
<scroll-view @scrolltolower="lowerBottom" scroll-y="true" style="max-height: 92vh;" @scroll="scroll"
|
|
|
:scroll-top="scrollTop">
|
|
|
+ <view class="recentSearches" v-if="recentSearches.length != 0">
|
|
|
+ <view class="recentSearches-head">
|
|
|
+ <view class="recentSearches-headLeft">
|
|
|
+ <u-icon name="clock" color="#C4C4C4"></u-icon>
|
|
|
+ <view style="font-size: 26rpx;margin-left: 6rpx;">最近搜索</view>
|
|
|
+ </view>
|
|
|
+ <view class="recentSearches-headRight">
|
|
|
+ <u-icon name="trash" size="20px" @click="searchDeleteShow = true" color="#C4C4C4"></u-icon>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="recentSearches-text">
|
|
|
+ <u-tag v-for="(item,index) in recentSearches" :key="index" :text="item" bgColor="#EFEFEF"
|
|
|
+ color="#414141" borderColor="#EFEFEF" size="medium" closable :show="item" @close="tagClose(index)"
|
|
|
+ shape="circle" @click.stop="tagSearches(item)"></u-tag>
|
|
|
+ </view>
|
|
|
+ <u-modal :show="searchDeleteShow" content="确认删除搜索记录吗?" showCancelButton @confirm="searchDeletefun"
|
|
|
+ @cancel="searchDeleteShow = false" ref="uModal" :asyncClose="true">
|
|
|
+ </u-modal>
|
|
|
+ </view>
|
|
|
<view class="tagClass">
|
|
|
<view v-for="(item, index) in radios" :key="index" style="margin:0 6rpx;">
|
|
|
<u-tag :text="item.label" :bgColor="item.checked?'#E75F37':'#fff'" borderColor='#E75F37'
|
|
@@ -19,7 +38,7 @@
|
|
|
</view>
|
|
|
<view style="margin:0 6rpx;width: 2rpx;height: 43rpx;background: #E75F37;border-radius: 1rpx;"></view>
|
|
|
<view style="margin:0 6rpx;">
|
|
|
- <u-tag text="清空" bgColor="#F8AA09" borderColor='#F8AA09' color="#fff" @click="emptyfun" size="mini">
|
|
|
+ <u-tag text="重置" bgColor="#F8AA09" borderColor='#F8AA09' color="#fff" @click="emptyfun" size="mini">
|
|
|
</u-tag>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -67,7 +86,7 @@
|
|
|
|
|
|
</view>
|
|
|
<view class="cardPrice">
|
|
|
- ¥{{item.mallPrice}}
|
|
|
+ ¥{{checkStatus == '通过'?item.mallPrice:'***'}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -92,7 +111,7 @@
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
- <view v-if="userInfo.tenant_id != '000000'" class="suspensionBox" @click="salesmanShow=true">
|
|
|
+ <view v-if="userInfo.tenant_id != '000000'" class="suspensionBox" @click="opensalesman">
|
|
|
<u-icon name="server-fill" color="#2979ff" size="30"></u-icon>
|
|
|
</view>
|
|
|
<u-modal :show="salesmanShow" title="业务员联系方式" showCancelButton confirmText="拨号" cancelText="关闭"
|
|
@@ -168,31 +187,6 @@
|
|
|
},
|
|
|
mounted() {},
|
|
|
onLoad(data) {
|
|
|
- // 获取审核状态
|
|
|
- details().then(res => {
|
|
|
- this.checkStatus = res.data.checkStatus
|
|
|
- uni.setStorageSync('checkStatus', res.data.checkStatus);
|
|
|
- if (this.checkStatus != '通过') {
|
|
|
- // uni.showToast({
|
|
|
- // title: "当前用户未授权,请联系客服",
|
|
|
- // icon: "none",
|
|
|
- // mask:true
|
|
|
- // });
|
|
|
- uni.switchTab({
|
|
|
- url: '/pages/tabBar/home'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- this.salesmanName = res.data.salesmanName
|
|
|
- // 查询业务员详情拿取手机号
|
|
|
- if (!this.phoneNumber) {
|
|
|
- nameDetail({
|
|
|
- id: res.data.salesmanId
|
|
|
- }).then(res => {
|
|
|
- this.phoneNumber = res.data.phone
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
listAll2({
|
|
|
type: 'PP',
|
|
|
enableOrNot: '1',
|
|
@@ -208,13 +202,7 @@
|
|
|
current: 1
|
|
|
}
|
|
|
this.dataList = []
|
|
|
- // let searchCache =
|
|
|
- // uni.removeStorageSync('homeSearch')
|
|
|
- if (uni.getStorageSync('homeSearch')) {
|
|
|
- this.name = JSON.parse(JSON.stringify(uni.getStorageSync('homeSearch')))
|
|
|
- this.custom()
|
|
|
-
|
|
|
- } else if (uni.getStorageSync('cname')) {
|
|
|
+ if (uni.getStorageSync('cname')) {
|
|
|
this.$set(this.search, 'cname', JSON.parse(JSON.stringify(uni.getStorageSync('cname'))))
|
|
|
uni.removeStorage('cname')
|
|
|
this.page = {
|
|
@@ -232,41 +220,92 @@
|
|
|
this.search = {
|
|
|
whether: '0',
|
|
|
}
|
|
|
- console.log(1111)
|
|
|
this.onSearch()
|
|
|
}
|
|
|
})
|
|
|
- uni.$on('searchData', (data) => {
|
|
|
- this.radios.map((item, index) => {
|
|
|
- item.checked = false
|
|
|
- });
|
|
|
- this.checkboxValue = []
|
|
|
- this.dataList = []
|
|
|
- this.search.originalFactory = null
|
|
|
- this.search.selfRecovery = null
|
|
|
- this.search.explosionProof = null
|
|
|
- this.name = data
|
|
|
- setTimeout(() => {
|
|
|
- this.custom()
|
|
|
- }, 400);
|
|
|
-
|
|
|
- })
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
- // uni.$off('searchData', (data) => {
|
|
|
-
|
|
|
- // })
|
|
|
},
|
|
|
onShow() {
|
|
|
+ this.getUpdate()
|
|
|
+ // 获取审核状态
|
|
|
+ details().then(res => {
|
|
|
+ this.checkStatus = res.data.checkStatus
|
|
|
+ uni.setStorageSync('checkStatus', res.data.checkStatus);
|
|
|
+ // if (this.checkStatus != '通过') {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: "当前用户未授权,请联系客服",
|
|
|
+ // icon: "none",
|
|
|
+ // mask:true
|
|
|
+ // });
|
|
|
+ // // uni.switchTab({
|
|
|
+ // // url: '/pages/tabBar/home'
|
|
|
+ // // })
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ this.salesmanName = res.data.salesmanName
|
|
|
+ // 查询业务员详情拿取手机号
|
|
|
+ if (!this.phoneNumber) {
|
|
|
+ nameDetail({
|
|
|
+ id: res.data.salesmanId
|
|
|
+ }).then(res => {
|
|
|
+ this.phoneNumber = res.data.phone
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
this.userInfo = uni.getStorageSync('userInfo')
|
|
|
// 获取最近搜索数据
|
|
|
if (uni.getStorageSync('recentSearches')) {
|
|
|
- this.recentSearches = uni.getStorageSync('recentSearches');
|
|
|
+ this.recentSearches = uni.getStorageSync('recentSearches').slice(0, 8);
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
methods: {
|
|
|
+ getUpdate() {
|
|
|
+ const updateManager = uni.getUpdateManager();
|
|
|
+ updateManager.onCheckForUpdate(function(res) {
|
|
|
+ // 请求完新版本信息的回调
|
|
|
+ if (res.hasUpdate) {
|
|
|
+ updateManager.onUpdateReady(function() {
|
|
|
+ uni.showModal({
|
|
|
+ title: '更新提示',
|
|
|
+ content: '新版本已经准备好,是否重启应用?',
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
|
+ updateManager.applyUpdate();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ updateManager.onUpdateFailed(function() {
|
|
|
+ // 新的版本下载失败
|
|
|
+ uni.showModal({
|
|
|
+ title: '已经有新版本了哟~',
|
|
|
+ content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ opensalesman(){
|
|
|
+ if (this.checkStatus != '通过') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "当前用户未授权,请联系客服",
|
|
|
+ icon: "none",
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.salesmanShow=true
|
|
|
+ },
|
|
|
openBrand() {
|
|
|
+ if (this.checkStatus != '通过') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "当前用户未授权,请联系客服",
|
|
|
+ icon: "none",
|
|
|
+ mask:true
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
this.$refs.popup.open('bottom')
|
|
|
},
|
|
|
goTop(e) {
|
|
@@ -320,6 +359,14 @@
|
|
|
this.onSearch()
|
|
|
},
|
|
|
checkboxChange(value, index) {
|
|
|
+ if (this.checkStatus != '通过') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "当前用户未授权,请联系客服",
|
|
|
+ icon: "none",
|
|
|
+ mask:true
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
this.radios.map((item, index) => {
|
|
|
item.checked = item.label === value ? true : false;
|
|
|
});
|
|
@@ -346,7 +393,14 @@
|
|
|
},
|
|
|
// 加入购物车
|
|
|
shoppingCartfun(row) {
|
|
|
- console.log(row, 166);
|
|
|
+ if (this.checkStatus != '通过') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "当前用户未授权,请联系客服",
|
|
|
+ icon: "none",
|
|
|
+ mask:true
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
if (row.inventory == 0) {
|
|
|
uni.showToast({
|
|
|
title: "当前商品库存为零",
|
|
@@ -437,17 +491,25 @@
|
|
|
// 最近搜索点击关闭按钮
|
|
|
tagClose(index) {
|
|
|
this.recentSearches.splice(index, 1)
|
|
|
- uni.setStorageSync('recentSearches', this.recentSearches);
|
|
|
+ uni.setStorageSync('recentSearches', this.recentSearches.slice(0, 8));
|
|
|
},
|
|
|
selectProduct(item) {
|
|
|
+ if (this.checkStatus != '通过') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "当前用户未授权,请联系客服",
|
|
|
+ icon: "none",
|
|
|
+ mask:true
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
uni.$u.route('/pages/views/buyGoods/commodityDetails', {
|
|
|
id: item.id
|
|
|
});
|
|
|
},
|
|
|
inSearch() {
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pages/tabBar/searchPage?searchData=${this.name?this.name:''}`
|
|
|
- })
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: `/pages/tabBar/searchPage?searchData=${this.name?this.name:''}`
|
|
|
+ // })
|
|
|
},
|
|
|
lowerBottom() {
|
|
|
this.status = 'loading'
|
|
@@ -460,7 +522,21 @@
|
|
|
},
|
|
|
// 搜索
|
|
|
custom() {
|
|
|
- uni.removeStorageSync('homeSearch')
|
|
|
+ if(this.userInfo.tenant_id=='000000'){
|
|
|
+ uni.showToast({
|
|
|
+ title: '请点右下角<我的> 授权登录!',
|
|
|
+ icon :'none'
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.checkStatus != '通过') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "当前用户未授权,请联系客服",
|
|
|
+ icon: "none",
|
|
|
+ mask:true
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
this.current = -1
|
|
|
this.page = {
|
|
|
total: 0,
|
|
@@ -471,8 +547,8 @@
|
|
|
this.recentSearches.unshift(this.name)
|
|
|
// 去重
|
|
|
this.recentSearches = this.recentSearches.filter((item, index) => this.recentSearches.indexOf(item) ===
|
|
|
- index);
|
|
|
- uni.setStorageSync('recentSearches', this.recentSearches);
|
|
|
+ index).slice(0, 8);
|
|
|
+ uni.setStorageSync('recentSearches', this.recentSearches.slice(0, 8));
|
|
|
}
|
|
|
delete this.search.brandId
|
|
|
this.search.cname = this.name
|
|
@@ -573,7 +649,7 @@
|
|
|
|
|
|
.tagClass {
|
|
|
display: flex;
|
|
|
- padding: 41rpx 63rpx;
|
|
|
+ padding: 8rpx 63rpx 18rpx 63rpx;
|
|
|
background-color: #fff;
|
|
|
justify-content: space-around;
|
|
|
|
|
@@ -619,13 +695,13 @@
|
|
|
.cardKc {
|
|
|
text-align: center;
|
|
|
position: absolute;
|
|
|
- right: 4rpx;
|
|
|
+ right: 0rpx;
|
|
|
top: 3rpx;
|
|
|
font-size: 22rpx;
|
|
|
color: #FFFFFF;
|
|
|
font-weight: 500;
|
|
|
- width: 43rpx;
|
|
|
- height: 28rpx;
|
|
|
+ width: 49rpx;
|
|
|
+ height: 26rpx;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -636,4 +712,31 @@
|
|
|
font-weight: 500;
|
|
|
}
|
|
|
}
|
|
|
+ .recentSearches {
|
|
|
+ padding: 8rpx 12rpx;
|
|
|
+ background-color: #fff;
|
|
|
+
|
|
|
+ .recentSearches-head {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ color: #C4C4C4;
|
|
|
+
|
|
|
+ .recentSearches-headLeft {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .recentSearches-headRight {}
|
|
|
+ }
|
|
|
+
|
|
|
+ .recentSearches-text {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ align-items: baseline;
|
|
|
+ ::v-deep .u-tag__close{
|
|
|
+ z-index: 99 !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|