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', method: 'get',
}) })
}, },
// 删除
deleteByUserId(data) {
// 油站渠道
getSiteChannelList(data) {
return request({
url: '/oil-site/oilSiteChannel/getSiteChannelList',
method: 'post',
data
})
},
// 权限
getSiteCloudRoles() {
return request({ return request({
url: '/oil-user/sysRole/getSiteCloudRoles', url: '/oil-user/oilCustomerCompanyRelation/deleteByUserId',
method: 'get'
})
},
// 新增
saveCustomerRelationSite(data) {
return request({
url: '/oil-user/oilCustomerChannelRelation/saveCustomerRelationSite',
method: 'post', method: 'post',
data data
}) })
}, },
} }

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

@ -79,8 +79,9 @@
</uni-list> </uni-list>
</view> </view>
<view class="button-group"> <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 v-else class="button blue" @tap="submit">保存</view>
<view class="button special red" @tap="deleteData">删除</view>
</view> </view>
</view> </view>
</template> </template>
@ -98,7 +99,7 @@
postData: { postData: {
phone: '', phone: '',
userName: '', userName: '',
password:'', password: '',
sysUserRoleList: [], sysUserRoleList: [],
oilCompanyInfoList: [], oilCompanyInfoList: [],
}, },
@ -134,6 +135,28 @@
}) })
}, },
methods: { 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() { getByUserId() {
serve.getByUserId(this.postData.id).then(res => { serve.getByUserId(this.postData.id).then(res => {
this.$set(this.postData, 'sysUserRoleList', res.data.sysUserRoleList) this.$set(this.postData, 'sysUserRoleList', res.data.sysUserRoleList)
@ -159,7 +182,7 @@
WrongText: '请选择所属权限' WrongText: '请选择所属权限'
} }
} }
if(this.isAdd) { if (this.isAdd) {
needCheckMap['password'] = { needCheckMap['password'] = {
tacitly: '', tacitly: '',
WrongText: '请输入用户密码' WrongText: '请输入用户密码'
@ -344,9 +367,13 @@
color: #fff; color: #fff;
border-radius: 10rpx; border-radius: 10rpx;
// &:nth-of-type(2) { &.special {
// margin-top: 50rpx; margin-top: 35rpx;
// } }
&.orange {
background: #FF8C00;
}
&.red { &.red {
background: #EA0000; background: #EA0000;

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

Loading…
Cancel
Save