123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 |
- <template>
- <view>
- <u-form :model="form" ref="uForm">
- <u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false">
- <view slot="head">
- <view class="u-flex">
- <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
- 选择合作品牌
- </view>
- </view>
- <view slot="body">
- <u-form-item prop="cooperation">
- <view style="margin-right: 10rpx;">
- <u-icon name="order" size="36"></u-icon>
- </view>
- <u-input placeholder="点击选择合作品牌" :disabled="true" @click="brandShow = true;" v-model="form.cooperation"></u-input>
- <view class="" slot="right">
- <u-icon name="arrow-right" color="#666666" size="36"></u-icon>
- </view>
- </u-form-item>
- </view>
- </u-card>
- <u-popup mode="bottom" v-model="brandShow">
- <view class="u-flex u-row-between u-padding-left-40 u-padding-right-40" style="height: 90rpx;" @click="show = false;">
- <view style="padding: 16rpx;font-size:30rpx" @click="brandShow=false">
- 取消
- </view>
- <view style="padding: 16rpx;color:#0095FF;font-size:30rpx" @click="getCooperation">
- 确认
- </view>
- </view>
- <u-line color="#e4e7ed"></u-line>
- <view class="content">
- <scroll-view scroll-y="true" style="height: 300rpx;">
- <view class="u-flex u-row-center">
- <u-checkbox-group :wrap="true" @change="checkboxGroupChange" style="display: flex;justify-content: center">
- <u-checkbox v-model="item.checked" v-for="(item, index) in brandList" :key="index" :name="item.brand" shape="circle">
- <view class="u-flex u-row-left" style="width: 150rpx;">
- {{item.brand}}
- </view>
- </u-checkbox>
- </u-checkbox-group>
- </view>
- </scroll-view>
- </view>
- </u-popup>
- <u-card v-if="querybrandList.length" :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false">
- <view slot="head">
- <view class="u-flex">
- <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
- 已选合作品牌
- </view>
- </view>
- <view slot="body" style="display:flex;width:100%;flex-flow: wrap;justify-content: space-around;align-items: center;">
- <view v-for="(item,index) in querybrandList" :key="index" style="width: 250rpx;">
- <u-image width="250rpx" :src="item.logUrl" mode="widthFix"></u-image>
- </view>
- </view>
- </u-card>
- <u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false"
- v-for="(item, index) in checkedAgentlist" :key="index">
- <view slot="head">
- <view class="u-flex">
- <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
- {{item.brand}}合作品牌签约任务
- </view>
- </view>
- <view slot="body">
- <u-form-item>
- <view style="margin-right: 10rpx;">
- <u-icon name="account" size="36"></u-icon>
- </view>
- <view class="">
- {{item.name}}
- </view>
- </u-form-item>
- <u-form-item prop="taskNum">
- <view style="margin-right: 10rpx;">
- <u-icon name="order" size="36"></u-icon>
- </view>
- <u-radio-group v-model="item.taskNum" :disabled="item.disabledGroup" @change="changeRadiogroup(item)">
- <u-radio v-for="(i, index) in tasknameList" :key="index" :name="i.signLv">
- {{i.signLv}}
- </u-radio>
- </u-radio-group>
- </u-form-item>
- </view>
- </u-card>
- <u-form-item :border-bottom="false">
- <view style="margin:0 30rpx;">
- <u-checkbox-group>
- <u-checkbox v-model="protocol">同意《用户协议》及《隐私政策》</u-checkbox>
- </u-checkbox-group>
- </view>
- </u-form-item>
- </u-form>
- <view style="margin:0 30rpx;">
- <u-button @click="nextStep" type="primary" @tap="$u.debounce(submit, 2000,immediate = true)" :loading="loading"
- :ripple="true" ripple-bg-color="#99d4ff">确认注册</u-button>
- </view>
- </view>
- </template>
- <script>
- import {
- request
- } from '../../common/request/request'
- require("promise.prototype.finally").shim()
- export default {
- data() {
- return {
- brandShow: false,
- loading: false,
- form: {
- cooperation: '',
- },
- formData: '',
- dataUrl: '',
- agentList: [], //经销商信息
- checkedAgentlist: [],
- taskList: [],
- tasknameList: [],
- brandAgentLvQueryList: [],
- rules: {
- cooperation: [{
- required: true,
- message: '请选择品牌',
- trigger: 'blur,change'
- }]
- },
- protocol: false,
- querybrandList:[],
- brandList:[]
- }
- },
- created() {
- uni.$on('formData', (data) => {
- this.formData = data.formData
- this.dataUrl = data.dataUrl
- })
- },
- mounted() {
- this.getAgentArea()
- this.getTasknum()
- },
- methods: {
- getAgentArea() {
- console.log(this.formData)
- request({
- url: '/sailun/appStoreBasicInfo/getAgentArea',
- method: 'post',
- data:{
- "area": this.formData.district,
- "city": this.formData.city,
- "province": this.formData.province,
- // "area": "市北区",
- // "city": "青岛市",
- // "province": "山东省",
- "spart": "10",
- "vkorg": "8100",
- "vtweg": "10"
- }
- }).then(res => {
- if (res.data.code == 0) {
- this.agentList = res.data.Data.data
- this.agentList = this.agentList.reduce((res, item, index, array) => {
- for (let i = 0; i < array[index].regionBrandList.length; ++i) {
- res.push({
- brand: array[index].regionBrandList[i],
- brandCode: array[index].regionBrandList[i],
- name: item.name,
- kunnr: item.kunnr,
- agent_id: item.kunnr,
- taskNum: "",
- disabledGroup:false,
- })
- }
- return res;
- }, []);
- this.brandList=[...new Set(this.agentList.reduce((res, item, index, array) => {
- res.push(item.brand)
- return res;
- }, []))].reduce((res, item, index, array) => {
- res.push({brand:item})
- return res;
- }, []);
- }
- if (res.data.code == 500) {
- this.$u.toast(res.data.msg);
- }
- return this.agentList
- }).catch(err => {
- console.log(err)
- }).finally(() => {
- })
- },
- getQuerybrand(){
- request({
- url: '/sailun/appStoreBasicInfo/queryBrand',
- method: 'get',
- data: {},
- }).then(res => {
- if (res.data.code == 0) {
- this.querybrandList=res.data.data
- this.querybrandList = this.querybrandList.filter(item => this.cooperations.indexOf(item.brandCode) > -1)
- }
- if (res.data.code == 500) {
- this.$u.toast(res.data.msg);
- }
- }).catch(err => {
- console.log(err)
- }).finally(() => {
-
- })
- },
- getTasknum() {
- request({
- url: '/sailun/appStoreBasicInfo/enum',
- method: 'get',
- data: {},
- }).then(res => {
- if (res.data.code == 0) {
- this.tasknameList = res.data.data
- this.tasknameList.push({
- brand: null,
- brandCode: null,
- mainId:null,
- numTask:null,
- signLv: "无"
- })
- }
- if (res.data.code == 500) {
- this.$u.toast(res.data.msg);
- }
- }).catch(err => {
- console.log(err)
- }).finally(() => {
- })
- },
- checkboxGroupChange(e) {
- this.cooperations = e
- },
- changeRadiogroup(item){
- if(item.taskNum=="无"){
- this.checkedAgentlist.filter(e=>(e.brand===item.brand&&e.agent_id!=item.agent_id)).forEach(e=>e.disabledGroup=false)
- }else{
- this.checkedAgentlist.filter(e=>(e.brand===item.brand&&e.agent_id!=item.agent_id)).forEach(e=>e.disabledGroup=true)
- }
- },
- getCooperation() {
- if (this.cooperations != null) {
- this.form.cooperation = this.cooperations.toString();
- this.checkedAgentlist = this.agentList.filter(item => this.cooperations.indexOf(item.brand) > -1)
- this.getQuerybrand()
- this.brandShow = false
- } else {
- console.log("至少选择一项")
- }
- },
- getTaskconfirm(e) {
- this.form.tasklist = e[0].label;
- },
- submit() {
- this.$refs.uForm.validate(valid => {
- if (valid) {
- if(!this.protocol)return this.$u.toast('请勾选协议');
- console.log('验证通过');
- } else {
- console.log('验证失败');
- }
- });
- this.brandAgentLvQueryList = this.checkedAgentlist.reduce((res, item) => {
- res.push({
- agent_id: item.agent_id,
- agent_name:item.name,
- brand: item.brand,
- brandCode: item.brandCode,
- kunnr: item.kunnr,
- lvCount: parseInt(item.taskNum.substring(2)).toString(),
- showLv: item.taskNum,
- spart: "10",
- vkorg: "8100",
- vtweg: "10"
- })
- return res;
- }, []);
- let data = {
- "brandAgentLvQueryList":this.brandAgentLvQueryList,
- "city":this.formData.city,
- "contactName":this.formData.name,
- "district":this.formData.district,
- "jd":this.formData.longitude,
- "licenseUrl":this.dataUrl.licenseUrl,
- "mobileCode":this.formData.code,
- "province":this.formData.province,
- "storeImageUrl":this.dataUrl.storeUrl,
- "storeName":this.formData.store,
- "storePhone":this.formData.phone,
- "version":1.00,
- "wd":this.formData.latitude,
- }
- console.log(data)
- request({
- url: '/sailun/appStoreBasicInfo/storeReg',
- method: 'post',
- data: data
- }).then(res => {
- console.log(res)
- if (res.data.code == 0) {
- this.loading = true
- this.$u.toast(res.data.msg);
- setTimeout(() => {
- this.$u.route({
- url: 'pages/login/index',
- })
- }, 2000)
- }
- if (res.data.code == 500) {
- this.$u.toast(res.data.msg);
- }
- }).catch(err => {
- console.log(err)
- }).finally(() => {
- this.loading = false
- })
- },
- },
- onReady() {
- this.$refs.uForm.setRules(this.rules);
- }
- }
- </script>
- <style lang="scss" scoped>
- .content {
- padding: 24rpx;
- text-align: center;
- .u-checkbox[data-v-54acf820] {
- display: flex;
- justify-content: center;
- }
- }
- </style>
|