|
@@ -4,7 +4,7 @@
|
|
|
<view style='background:#fff;display:flex;' class="cu-bar search">
|
|
|
<view style='flex:6;' class="search-form round Medium">
|
|
|
<text style='color: #ccc;text-indent:6px;' class="cuIcon-search"></text>
|
|
|
- <input type="text" maxlength="20" :focus="true" v-model="searchKeyWord" @confirm="doSearch()"
|
|
|
+ <input @input='searchinput' type="text" maxlength="20" :focus="true" v-model="searchKeyWord" @confirm="doSearch()"
|
|
|
placeholder="输入客户姓名或手机号" confirm-type="search"></input>
|
|
|
</view>
|
|
|
<view @click='doSearch()' class="Regular" style="width:4%;flex:1;">搜索</view>
|
|
@@ -13,11 +13,11 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="content">
|
|
|
- <view v-if='searchKeyWord.length==0'>近期客户</view>
|
|
|
- <view v-if='searchKeyWord.length>0' class='searchwrap' v-for='item in gridList' @click='checkcustomer(item)'>
|
|
|
+ <view style='padding-left:20px;color:#AFB3BF;font-size:14px;' v-if='show==false'>近期客户</view>
|
|
|
+ <view v-if='searchKeyWord.length>0&&show==true' class='searchwrap' v-for='item in gridList' @click='checkcustomer(item)'>
|
|
|
{{item.customerName}}({{item.customerPhone}})
|
|
|
</view>
|
|
|
- <view class='wrap' v-else>{{item.customerName}}({{item.customerPhone}})</view>
|
|
|
+ <view @click='recentcustomer(item)' class='wrap' v-else>{{item.searchContent}}</view>
|
|
|
</view>
|
|
|
|
|
|
<view v-show="isContent">
|
|
@@ -71,6 +71,8 @@
|
|
|
showTran: true,
|
|
|
companyId: 1,
|
|
|
current: 4,
|
|
|
+ customerList:[],
|
|
|
+ purchasePriceList:[],
|
|
|
warehouseCount:'',
|
|
|
commonWarehouseNo:'',
|
|
|
cangid:''
|
|
@@ -111,60 +113,167 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad(options){
|
|
|
- this.managementType=options.managementType
|
|
|
+ this.purchasePriceList=uni.getStorageSync('purchasePriceList')
|
|
|
},
|
|
|
onShow() {
|
|
|
this.gridList=[]
|
|
|
this.$api.doRequest('get', '/searchRecordsInfo/selectSearchRecordsInfo',{
|
|
|
- compId:'',
|
|
|
- authenticationStatusKey:7,
|
|
|
+ pageSize:this.pageSize,
|
|
|
+ currentPage:this.currentPage,
|
|
|
+ functionType:"3",
|
|
|
+ commonId:this.userInfo.id
|
|
|
}).then(res => {
|
|
|
if(res.data.data){
|
|
|
this.gridList=res.data.data.records
|
|
|
}
|
|
|
})
|
|
|
+ this.$api.doRequest('get', '/identityAuthenticationInfo/identityAuthenticationInfoCustomer',{
|
|
|
+ compId:'',
|
|
|
+ authenticationStatusKey:7,
|
|
|
+ }).then(res => {
|
|
|
+ if(res.data.data){
|
|
|
+ this.customerList=res.data.data
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
+ searchinput(e){
|
|
|
+ if(this.searchKeyWord.length==0){
|
|
|
+ this.show=false
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
checkcustomer(item){
|
|
|
- this.$api.doRequest('post', '/searchRecordsInfo/api/addInfo',{
|
|
|
- commonId:this.userInfo.id,
|
|
|
- searchContent:item.customerName,
|
|
|
- functionType:3
|
|
|
- }).then(res => {
|
|
|
- })
|
|
|
+ var that = this
|
|
|
+ var count=''
|
|
|
+ uni.showLoading({title: '加载中',mask:true})
|
|
|
+ if(item.authenticationStatus=='已认证'){
|
|
|
+
|
|
|
+ this.$api.doRequest('get', '/qualityInspectionManagement/api/settledCount',{
|
|
|
+ compId:'',
|
|
|
+ customerName: item.customerName,
|
|
|
+ goodsName: uni.getStorageSync('goodsName'),
|
|
|
+ }).then(res => {
|
|
|
+ if(res.data.code==200){
|
|
|
+ count=res.data.data
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ that.$api.doRequest('get', '/paymentManagement/cumulant',{
|
|
|
+ compId:'',
|
|
|
+ customerName: item.customerName,
|
|
|
+ goodsName: uni.getStorageSync('goodsName'),
|
|
|
+ }).then(res => {
|
|
|
+ for (let i = 0; i < this.purchasePriceList.length; i++) {
|
|
|
+ if(this.purchasePriceList[i].goodsName== uni.getStorageSync('goodsName')){
|
|
|
+ if(this.purchasePriceList[i].saleLimit - res.data.data < 50 || count > 0){
|
|
|
+ this.$api.msg(`当前客户已累计销售我司${uni.getStorageSync('goodsName')}${res.data.data}吨,最高可售${this.purchasePriceList[i].saleLimit}吨。`)
|
|
|
+ }else{
|
|
|
+ that.$api.doRequest('post', '/searchRecordsInfo/api/addInfo',{
|
|
|
+ commonId:that.userInfo.id,
|
|
|
+ searchContent:item.customerName+'('+item.customerPhone+')',
|
|
|
+ functionType:3
|
|
|
+ }).then(res => {
|
|
|
+ uni.hideLoading()
|
|
|
+ uni.setStorageSync('checkcustomer',item)
|
|
|
+ uni.navigateBack()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }else{
|
|
|
+ this.$api.msg('客户身份不可用')
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ recentcustomer(item){
|
|
|
+ var count=''
|
|
|
+ var that = this
|
|
|
+ var name=item.searchContent.split('(')[0]
|
|
|
+
|
|
|
+ for(var i=0;i<this.customerList.length;i++){
|
|
|
+ // console.log(name,this.customerList[i].customerName,name==this.customerList[i].customerName)
|
|
|
+ if(this.customerList[i].customerName==name){
|
|
|
+ uni.showLoading({title: '加载中',mask:true})
|
|
|
+ this.$api.doRequest('get', '/qualityInspectionManagement/api/settledCount',{
|
|
|
+ compId:'',
|
|
|
+ customerName: this.customerList[i].customerName,
|
|
|
+ goodsName: uni.getStorageSync('goodsName'),
|
|
|
+ }).then(res => {
|
|
|
+ if(res.data.code==200){
|
|
|
+ count=res.data.data
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ that.$api.doRequest('get', '/paymentManagement/cumulant',{
|
|
|
+ compId:'',
|
|
|
+ customerName: this.customerList[i].customerName,
|
|
|
+ goodsName: uni.getStorageSync('goodsName'),
|
|
|
+ }).then(res => {
|
|
|
+ for (let i = 0; i < this.purchasePriceList.length; i++) {
|
|
|
+ if(this.purchasePriceList[i].goodsName== uni.getStorageSync('goodsName')){
|
|
|
+ if(this.purchasePriceList[i].saleLimit - res.data.data < 50 || count > 0){
|
|
|
+ this.$api.msg(`当前客户已累计销售我司${uni.getStorageSync('goodsName')}${res.data.data}吨,最高可售${this.purchasePriceList[i].saleLimit}吨。`)
|
|
|
+ }else{
|
|
|
+ that.$api.doRequest('post', '/searchRecordsInfo/api/addInfo',{
|
|
|
+ commonId:that.userInfo.id,
|
|
|
+ searchContent:this.customerList[i].customerName+'('+this.customerList[i].customerPhone+')',
|
|
|
+ functionType:3
|
|
|
+ }).then(res => {
|
|
|
+ uni.hideLoading()
|
|
|
+ uni.setStorageSync('checkcustomer',this.customerList[i])
|
|
|
+ uni.navigateBack()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
emptysearch(){
|
|
|
+ this.show=false
|
|
|
this.searchKeyWord=''
|
|
|
this.gridList=[]
|
|
|
this.currentPage=1
|
|
|
this.getList()
|
|
|
},
|
|
|
doSearch(){
|
|
|
+ this.show=true
|
|
|
this.gridList=[]
|
|
|
this.currentPage=1
|
|
|
this.getList()
|
|
|
},
|
|
|
- warehousechange(e){
|
|
|
- this.warehouseName=this.selector[e[0]].warehouseName
|
|
|
- this.cangid=this.selector[e[0]].id
|
|
|
- this.warehouseCount = this.selector[e[0]].count
|
|
|
- this.commonWarehouseNo=this.selector[e[0]].commonWarehouseNo
|
|
|
- uni.setStorageSync('purchasePriceList',this.selector[e[0]].purchasePriceList)
|
|
|
- this.getList()
|
|
|
- console.log(e)
|
|
|
- },
|
|
|
getList(){
|
|
|
var that = this
|
|
|
- this.$api.doRequest('get', '/identityAuthenticationInfo/identityAuthenticationInfoCustomer',{
|
|
|
- compId:'',
|
|
|
- authenticationStatusKey:7,
|
|
|
- searchKeyWord:this.searchKeyWord
|
|
|
- }).then(res => {
|
|
|
+ var url=''
|
|
|
+ var data={}
|
|
|
+ if(this.searchKeyWord.length>0){
|
|
|
+ url='/identityAuthenticationInfo/identityAuthenticationInfoCustomer'
|
|
|
+ data={
|
|
|
+ compId:'',
|
|
|
+ authenticationStatusKey:7,
|
|
|
+ searchKeyWord:this.searchKeyWord
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ url='/searchRecordsInfo/selectSearchRecordsInfo'
|
|
|
+ data={
|
|
|
+ pageSize:this.pageSize,
|
|
|
+ currentPage:this.currentPage,
|
|
|
+ functionType:"3",
|
|
|
+ commonId:this.userInfo.id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$api.doRequest('get', url,data).then(res => {
|
|
|
if(res.data.data){
|
|
|
- let data = res.data.data
|
|
|
+ let data = res.data.data.records?res.data.data.records:res.data.data
|
|
|
//采购信息
|
|
|
if (data.length > 0) {
|
|
|
- that.gridList = that.gridList.concat(data)
|
|
|
+ that.gridList = data
|
|
|
}else{
|
|
|
if(this.currentPage==1){
|
|
|
that.gridList=[]
|
|
@@ -172,7 +281,6 @@
|
|
|
this.isContent=true
|
|
|
}
|
|
|
}
|
|
|
- // console.log(that.gridList)
|
|
|
})
|
|
|
},
|
|
|
edit(item){
|