pull/2/head
xiaozhiyong 2 years ago
parent 6b0e5e7399
commit 4a6d49610d
  1. 33
      api/userManagement/customer.js
  2. 9
      api/userManagement/yunSite.js
  3. 39
      userManagement/customer/detail.vue
  4. 112
      userManagement/yunSite/detail.vue

@ -49,39 +49,12 @@ export default {
method: 'get',
})
},
// 油站渠道
getSiteChannelList(data) {
return request({
url: '/oil-site/oilSiteChannel/getSiteChannelList',
method: 'post',
data
})
},
// 权限
getSiteCloudRoles() {
// 删除
deleteByUserId(data) {
return request({
url: '/oil-user/sysRole/getSiteCloudRoles',
method: 'get'
})
},
// 新增
saveCustomerRelationSite(data) {
return request({
url: '/oil-user/oilCustomerChannelRelation/saveCustomerRelationSite',
url: '/oil-user/oilCustomerCompanyRelation/deleteByUserId',
method: 'post',
data
})
},
}

@ -41,5 +41,12 @@ export default {
data
})
},
// 删除
removeCustomerRelationSite(data) {
return request({
url: '/oil-user/oilCustomerChannelRelation/removeCustomerRelationSite',
method: 'post',
data
})
},
}

@ -79,8 +79,9 @@
</uni-list>
</view>
<view class="button-group">
<view v-if="!wantUpdate" class="button red" @tap="update">修改</view>
<view v-if="!wantUpdate" class="button orange" @tap="update">修改</view>
<view v-else class="button blue" @tap="submit">保存</view>
<view class="button special red" @tap="deleteData">删除</view>
</view>
</view>
</template>
@ -98,7 +99,7 @@
postData: {
phone: '',
userName: '',
password:'',
password: '',
sysUserRoleList: [],
oilCompanyInfoList: [],
},
@ -134,6 +135,28 @@
})
},
methods: {
deleteData() {
uni.showModal({
title: '确定删除吗?',
success: res => {
if (res.confirm) {
serve.deleteByUserId({
id: this.postData.id
}).then(res => {
if (res.code === 20000) {
uni.showToast({
title: res.msg,
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
})
}
}
})
},
getByUserId() {
serve.getByUserId(this.postData.id).then(res => {
this.$set(this.postData, 'sysUserRoleList', res.data.sysUserRoleList)
@ -159,7 +182,7 @@
WrongText: '请选择所属权限'
}
}
if(this.isAdd) {
if (this.isAdd) {
needCheckMap['password'] = {
tacitly: '',
WrongText: '请输入用户密码'
@ -344,9 +367,13 @@
color: #fff;
border-radius: 10rpx;
// &:nth-of-type(2) {
// margin-top: 50rpx;
// }
&.special {
margin-top: 35rpx;
}
&.orange {
background: #FF8C00;
}
&.red {
background: #EA0000;

@ -8,7 +8,8 @@
<uni-list>
<uni-list-item>
<view class="list_header" slot="header">
<image v-if="isAdd" src="@/static/bt.png" style="width: 12rpx;position: absolute;left: -20rpx;" mode="widthFix" ></image>
<image src="@/static/bt.png" style="width: 12rpx;position: absolute;left: -23rpx;"
mode="widthFix"></image>
用户手机号
</view>
<view slot="body" class="list_right">
@ -18,7 +19,8 @@
</uni-list-item>
<uni-list-item>
<view class="list_header" slot="header">
<image v-if="isAdd" src="@/static/bt.png" style="width: 12rpx;position: absolute;left: -20rpx;" mode="widthFix" ></image>
<image src="@/static/bt.png" style="width: 12rpx;position: absolute;left: -23rpx;"
mode="widthFix"></image>
用户姓名
</view>
<view slot="body" class="list_right">
@ -35,7 +37,8 @@
<uni-list-item
@tap="jump('/userManagement/yunSite/components/serviceStation',{siteId:postData.siteId}, isAdd)">
<view class="list_header" slot="header">
<image v-if="isAdd" src="@/static/bt.png" style="width: 12rpx;position: absolute;left: -20rpx;" mode="widthFix" ></image>
<image src="@/static/bt.png" style="width: 12rpx;position: absolute;left: -23rpx;"
mode="widthFix"></image>
油站渠道
</view>
<view slot="body" class="list-frame site">
@ -44,24 +47,11 @@
<uni-icons v-show="isAdd" color="#999" type="right" size="15"></uni-icons>
</view>
</uni-list-item>
<!-- <uni-list-item direction="column"
@tap="jump('/userManagement/yunSite/components/serviceStation',postData.oilSiteInfoList)">
<view class="list_header" slot="header">
油站渠道
</view>
<view slot="body" class="list-frame">
<view>
<text class="label" v-for="(item,index) in postData.oilSiteInfoList"
:key="index">{{item.siteName}}</text>
</view>
<view v-if="!postData.oilSiteInfoList.length" class="tips">选择油站渠道</view>
<uni-icons v-show="wantUpdate" color="#999" type="right" size="15"></uni-icons>
</view>
</uni-list-item> -->
<uni-list-item direction="column"
@tap="jump('/userManagement/yunSite/components/auth',postData.sysRoleList)">
<view class="list_header" slot="header">
<image v-if="isAdd" src="@/static/bt.png" style="width: 12rpx;position: absolute;left: -20rpx;" mode="widthFix" ></image>
<image src="@/static/bt.png" style="width: 12rpx;position: absolute;left: -23rpx;"
mode="widthFix"></image>
所属权限
</view>
<view slot="body" class="list-frame">
@ -77,17 +67,18 @@
</uni-list>
</view>
<view class="button-group">
<view v-if="!wantUpdate" class="button red" @tap="update">修改</view>
<view v-if="!wantUpdate" class="button orange" @tap="update">修改</view>
<view v-else class="button blue" @tap="submit">保存</view>
<view class="button special red" @tap="deleteData">删除</view>
</view>
</view>
</template>
<script>
import tool from '@/utils/tool'
import serve from '@/api/userManagement/yunSite.js'
export default {
data() {
return {
@ -105,7 +96,7 @@
if (options.item) {
this.postData = JSON.parse(decodeURI(options.item))
if (!this.postData.sysRoleList) {
this.$set(this.postData,'sysRoleList',[])
this.$set(this.postData, 'sysRoleList', [])
}
} else this.isAdd = this.wantUpdate = true
@ -126,31 +117,51 @@
})
},
methods: {
deleteData() {
uni.showModal({
title: '确定删除吗?',
success: res => {
if (res.confirm) {
serve.removeCustomerRelationSite(this.postData).then(res => {
if (res.code === 20000) {
uni.showToast({
title: res.msg,
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
})
}
}
})
},
submit() {
let needCheckMap = {
customerName:{
tacitly:'',
WrongText:'请输入用户姓名'
customerName: {
tacitly: '',
WrongText: '请输入用户姓名'
},
phone:{
custom:/^[1][3,4,5,7,8,9][0-9]{9}$/,
WrongText:'请输入正确手机号码'
phone: {
custom: /^[1][3,4,5,7,8,9][0-9]{9}$/,
WrongText: '请输入正确手机号码'
},
siteName:{
tacitly:'',
WrongText:'请选择油站渠道'
siteName: {
tacitly: '',
WrongText: '请选择油站渠道'
},
sysRoleList:{
minLength:1,
WrongText:'请选择所属权限'
sysRoleList: {
minLength: 1,
WrongText: '请选择所属权限'
}
}
let check = tool.checkFn(this.postData,[],needCheckMap)
if(!check.result){
}
let check = tool.checkFn(this.postData, [], needCheckMap)
if (!check.result) {
uni.showToast({
title:check.WrongText,
icon:'none'
title: check.WrongText,
icon: 'none'
})
return
}
@ -178,9 +189,9 @@
update() {
this.wantUpdate = true
},
jump(path, item,banJump = true) {
if(!banJump) return
jump(path, item, banJump = true) {
if (!banJump) return
if (!this.wantUpdate) return
let url = item ? `${path}?item=${encodeURI(JSON.stringify(item))}` : path
uni.navigateTo({
@ -276,9 +287,10 @@
font-size: 24rpx;
color: #999;
text-align: right;
&.rel2rpx {
position: 'relative';
top: 2rpx
position: relative;
top: 5rpx
}
}
}
@ -314,9 +326,13 @@
color: #fff;
border-radius: 10rpx;
// &:nth-of-type(2) {
// margin-top: 50rpx;
// }
&.special {
margin-top: 35rpx;
}
&.orange {
background: #FF8C00;
}
&.red {
background: #EA0000;

Loading…
Cancel
Save