register_3.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <template>
  2. <view>
  3. <u-form :model="form" ref="uForm">
  4. <u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false">
  5. <view slot="head">
  6. <view class="u-flex">
  7. <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
  8. 选择合作品牌
  9. </view>
  10. </view>
  11. <view slot="body">
  12. <u-form-item prop="cooperation">
  13. <view style="margin-right: 10rpx;">
  14. <u-icon name="order" size="36"></u-icon>
  15. </view>
  16. <u-input placeholder="点击选择合作品牌" :disabled="true" @click="brandShow = true;" v-model="form.cooperation"></u-input>
  17. <view class="" slot="right">
  18. <u-icon name="arrow-right" color="#666666" size="36"></u-icon>
  19. </view>
  20. </u-form-item>
  21. </view>
  22. </u-card>
  23. <u-popup mode="bottom" v-model="brandShow">
  24. <view class="u-flex u-row-between u-padding-left-40 u-padding-right-40" style="height: 90rpx;" @click="show = false;">
  25. <view style="padding: 16rpx;font-size:30rpx" @click="brandShow=false">
  26. 取消
  27. </view>
  28. <view style="padding: 16rpx;color:#0095FF;font-size:30rpx" @click="getCooperation">
  29. 确认
  30. </view>
  31. </view>
  32. <u-line color="#e4e7ed"></u-line>
  33. <view class="content">
  34. <u-checkbox-group :wrap="true" @change="checkboxGroupChange" style="display: flex;justify-content: left">
  35. <u-checkbox v-model="item.checked" v-for="(item, index) in allbrandList" :key="index" :name="item.brandCode"
  36. shape="circle">
  37. <view class="u-flex u-row-left" style="width: 150rpx;">
  38. {{item.brandCode}}
  39. </view>
  40. </u-checkbox>
  41. </u-checkbox-group>
  42. </view>
  43. </u-popup>
  44. <u-card v-if="this.form.cooperation.length" :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)"
  45. border-radius="20" :show-foot="false">
  46. <view slot="head">
  47. <view class="u-flex">
  48. <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
  49. 已选合作品牌
  50. </view>
  51. </view>
  52. <view slot="body" style="display:flex;width:100%;flex-flow: wrap;justify-content: space-around;align-items: center;">
  53. <view v-for="(item,index) in querybrandList" :key="index" style="width: 250rpx;">
  54. <u-image width="250rpx" :src="item.logUrl" mode="widthFix"></u-image>
  55. </view>
  56. </view>
  57. </u-card>
  58. <u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false"
  59. v-for="(item, index) in checkedAgentlist" :key="index">
  60. <view slot="head">
  61. <view class="u-flex u-row-between">
  62. <view class="u-flex">
  63. <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
  64. {{item.brand}}合作品牌签约任务
  65. </view>
  66. <view @click="delAgent(index)">
  67. <u-icon name="close" color="#666666" size="36"></u-icon>
  68. </view>
  69. </view>
  70. </view>
  71. <view slot="body">
  72. <u-form-item>
  73. <view style="margin-right: 10rpx;">
  74. <u-icon name="account" size="36"></u-icon>
  75. </view>
  76. <view class="">
  77. {{item.name}}
  78. </view>
  79. </u-form-item>
  80. <u-form-item prop="taskNum">
  81. <view style="margin-right: 10rpx;">
  82. <u-icon name="order" size="36"></u-icon>
  83. </view>
  84. <u-radio-group v-model="item.taskNum" :disabled="item.disabledGroup" @change="changeRadiogroup(item)">
  85. <u-radio @click.native.prevent="clickitem(item,i.signLv)" :label-disabled="i.labelDisabled" v-for="(i, index2) in tasknameList"
  86. :key="index2" :name="i.signLv">
  87. {{i.signLv}}
  88. </u-radio>
  89. </u-radio-group>
  90. </u-form-item>
  91. </view>
  92. </u-card>
  93. <u-card v-if="checkedAgentlist.length==0&&this.form.cooperation.length" :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)"
  94. border-radius="20" :show-foot="false">
  95. <view slot="head">
  96. <view class="u-flex">
  97. <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
  98. 温馨提示
  99. </view>
  100. </view>
  101. <view slot="body" style="display:flex;width:100%;flex-flow: wrap;justify-content: space-around;align-items: center;">
  102. 此地区暂无此品牌的经销商
  103. </view>
  104. </u-card>
  105. <u-form-item :border-bottom="false">
  106. <view style="margin:0 30rpx;">
  107. <u-checkbox-group>
  108. <u-checkbox v-model="protocol">同意《用户协议》及《隐私政策》</u-checkbox>
  109. </u-checkbox-group>
  110. </view>
  111. </u-form-item>
  112. </u-form>
  113. <view style="margin:0 30rpx 30rpx 30rpx">
  114. <u-button @click="submit" type="primary" :loading="loading" :ripple="true" ripple-bg-color="#99d4ff">确认注册</u-button>
  115. </view>
  116. </view>
  117. </template>
  118. <script>
  119. import {
  120. request
  121. } from '../../common/request/request'
  122. require("promise.prototype.finally").shim()
  123. export default {
  124. data() {
  125. return {
  126. brandShow: false,
  127. loading: false,
  128. form: {
  129. cooperation: '',
  130. },
  131. formData: '',
  132. dataUrl: '',
  133. agentList: [], //经销商信息
  134. checkedAgentlist: [],
  135. taskList: [],
  136. tasknameList: [],
  137. brandAgentLvQueryList: [],
  138. rules: {
  139. cooperation: [{
  140. required: true,
  141. message: '请选择品牌',
  142. trigger: 'blur,change'
  143. }]
  144. },
  145. protocol: false,
  146. querybrandList: [],
  147. // brandList: [],
  148. allbrandList: [], //弹出窗获取brand数组
  149. checkedBrandlist: [], //选中brand组成一个新数组
  150. appStoreBusinessLicenseDto: ''
  151. }
  152. },
  153. created() {
  154. uni.$on('formData', (data) => {
  155. this.formData = data.formData
  156. this.dataUrl = data.dataUrl
  157. })
  158. this.getAllbrandlist()
  159. },
  160. mounted() {
  161. this.getAgentArea()
  162. this.getTasknum()
  163. },
  164. methods: {
  165. getAgentArea() {
  166. uni.showLoading({
  167. title: '加载中...'
  168. });
  169. request({
  170. url: '/sailun/appStoreBasicInfo/getAgentArea',
  171. method: 'post',
  172. data: {
  173. "area": this.formData.district,
  174. "city": this.formData.city,
  175. "province": this.formData.province,
  176. // "area": "李沧区",
  177. // "city": "青岛市",
  178. // "province": "山东省",
  179. "spart": "10",
  180. "vkorg": "8100",
  181. "vtweg": "10"
  182. }
  183. }).then(res => {
  184. if (res.data.code == 0) {
  185. this.agentList = res.data.Data.data
  186. this.agentList = this.agentList.reduce((res, item, index, array) => {
  187. for (let i = 0; i < array[index].regionBrandList.length; i++) {
  188. res.push({
  189. brand: array[index].regionBrandList[i],
  190. brandCode: array[index].regionBrandList[i],
  191. name: item.name,
  192. kunnr: item.kunnr,
  193. agent_id: item.kunnr,
  194. taskNum: "",
  195. disabledGroup: false,
  196. checked: false,
  197. seriesCode: ""
  198. })
  199. }
  200. return res;
  201. }, []);
  202. // this.brandList = [...new Set(this.agentList.reduce((res, item, index, array) => {
  203. // res.push(item.brand)
  204. // return res;
  205. // }, []))].reduce((res, item, index, array) => {
  206. // res.push({
  207. // brand: item
  208. // })
  209. // return res;
  210. // }, []);
  211. }
  212. if (res.data.code == 500) {
  213. this.$u.toast(res.data.msg);
  214. }
  215. return this.agentList
  216. }).catch(err => {
  217. console.log(err)
  218. }).finally(() => {
  219. uni.hideLoading()
  220. })
  221. },
  222. getAllbrandlist() {
  223. request({
  224. url: '/sailun/appStoreBasicInfo/queryBrand',
  225. method: 'get',
  226. data: {},
  227. }).then(res => {
  228. if (res.data.code == 0) {
  229. this.allbrandList = res.data.data
  230. }
  231. if (res.data.code == 500) {
  232. this.$u.toast(res.data.msg);
  233. }
  234. }).catch(err => {
  235. console.log(err)
  236. }).finally(() => {
  237. })
  238. },
  239. getQuerybrand() {
  240. request({
  241. url: '/sailun/appStoreBasicInfo/queryBrand',
  242. method: 'get',
  243. data: {},
  244. }).then(res => {
  245. if (res.data.code == 0) {
  246. this.querybrandList = res.data.data
  247. this.querybrandList = this.querybrandList.filter(item => this.checkedBrandlist.indexOf(item.brandCode) > -1)
  248. }
  249. if (res.data.code == 500) {
  250. this.$u.toast(res.data.msg);
  251. }
  252. }).catch(err => {
  253. console.log(err)
  254. }).finally(() => {
  255. })
  256. },
  257. getTasknum() {
  258. request({
  259. url: '/sailun/appStoreBasicInfo/enum',
  260. method: 'get',
  261. data: {},
  262. }).then(res => {
  263. if (res.data.code == 0) {
  264. res.data.data.map((item, index) => {
  265. item.checked = false;
  266. })
  267. this.tasknameList = res.data.data
  268. }
  269. if (res.data.code == 500) {
  270. this.$u.toast(res.data.msg);
  271. }
  272. }).catch(err => {
  273. console.log(err)
  274. }).finally(() => {
  275. })
  276. },
  277. checkboxGroupChange(e) {
  278. this.cooperations = e
  279. },
  280. changeRadiogroup(item) {
  281. if (item.checked == true) {
  282. this.checkedAgentlist.filter(e => (e.brand === item.brand && e.agent_id != item.agent_id)).forEach(e => e.disabledGroup =
  283. false)
  284. this.checkedAgentlist.filter(e => (e.seriesCode === item.seriesCode && e.agent_id != item.agent_id)).forEach(e =>
  285. e.disabledGroup =
  286. false)
  287. } else {
  288. this.checkedAgentlist.filter(e => (e.brand === item.brand && e.agent_id != item.agent_id)).forEach(e => e.disabledGroup =
  289. true)
  290. this.checkedAgentlist.filter(e => (e.seriesCode === item.seriesCode && e.agent_id != item.agent_id)).forEach(e =>
  291. e.disabledGroup =
  292. true)
  293. }
  294. },
  295. clickitem(item, e) {
  296. if (item.checked == false) {
  297. item.checked = true
  298. } else {
  299. item.checked = false
  300. item.taskNum = ""
  301. }
  302. },
  303. getCooperation() {
  304. if (this.cooperations != null) {
  305. this.form.cooperation = this.cooperations.toString();
  306. this.allbrandList.map(item => {
  307. this.agentList.map(e => {
  308. if (e.brand == item.brandCode) {
  309. e.seriesCode = item.seriesCode
  310. }
  311. })
  312. })
  313. this.checkedAgentlist = this.agentList.filter(item => this.cooperations.indexOf(item.brand) > -1)
  314. this.checkedBrandlist = this.checkedAgentlist.reduce((res, item, index, array) => {
  315. res.push(item.brand)
  316. return res;
  317. }, []);
  318. this.getQuerybrand()
  319. this.brandShow = false
  320. } else {
  321. console.log("至少选择一项")
  322. }
  323. },
  324. getTaskconfirm(e) {
  325. this.form.tasklist = e[0].label;
  326. },
  327. delAgent(index) {
  328. this.checkedAgentlist.splice(index, 1)
  329. },
  330. submit() {
  331. this.$refs.uForm.validate(valid => {
  332. if (valid) {
  333. this.brandAgentLvQueryList = this.checkedAgentlist.filter(item => (item.disabledGroup != true))
  334. let checkenLength = this.checkedAgentlist.filter(item => (item.checked == false && item.disabledGroup == false))
  335. if (!this.brandAgentLvQueryList.length) return this.$u.toast('未正确选择经销商,请正确选择');
  336. if (checkenLength.length != 0) return this.$u.toast('请选择' + checkenLength[0].brand + "品牌签约任务");
  337. if (!this.protocol) return this.$u.toast('请阅读并同意用户协议和隐私协议');
  338. this.setData()
  339. } else {
  340. console.log('验证失败');
  341. }
  342. });
  343. },
  344. setData() {
  345. this.brandAgentLvQueryList = this.brandAgentLvQueryList.reduce((res, item) => {
  346. res.push({
  347. agent_id: item.agent_id,
  348. agent_name: item.name,
  349. brand: item.brand,
  350. brandCode: item.brandCode,
  351. kunnr: item.kunnr,
  352. lvCount: parseInt(item.taskNum.substring(2)).toString(),
  353. showLv: item.taskNum,
  354. spart: "10",
  355. vkorg: "8100",
  356. vtweg: "10"
  357. })
  358. return res;
  359. }, []);
  360. let data = {
  361. "appStoreBusinessLicenseDto": this.dataUrl.appStoreBusinessLicenseDto,
  362. "brandAgentLvQueryList": this.brandAgentLvQueryList,
  363. "city": this.formData.city,
  364. "contactName": this.formData.name,
  365. "district": this.formData.district,
  366. "jd": this.formData.longitude,
  367. "licenseUrl": this.dataUrl.licenseUrl,
  368. "mobileCode": this.formData.code,
  369. "province": this.formData.province,
  370. "storeImageUrl": this.dataUrl.storeUrl,
  371. "storeName": this.formData.store,
  372. "storePhone": this.formData.phone,
  373. "version": 1.00,
  374. "wd": this.formData.latitude,
  375. "addressInfo": this.formData.addressInfo
  376. }
  377. this.loading = true
  378. request({
  379. url: '/sailun/appStoreBasicInfo/storeReg',
  380. method: 'post',
  381. data: data
  382. }).then(res => {
  383. if (res.data.code == 0) {
  384. this.$u.toast("注册资料已提交成功");
  385. setTimeout(() => {
  386. this.$u.route({
  387. url: 'pages/login/index',
  388. })
  389. uni.$emit('loginphone', this.formData.phone)
  390. }, 2000)
  391. }
  392. if (res.data.code == 500) {
  393. this.$u.toast(res.data.msg);
  394. }
  395. }).catch(err => {
  396. console.log(err)
  397. }).finally(() => {
  398. setTimeout(() => {
  399. this.loading = false
  400. }, 2000)
  401. })
  402. }
  403. },
  404. onReady() {
  405. this.$refs.uForm.setRules(this.rules);
  406. }
  407. }
  408. </script>
  409. <style lang="scss" scoped>
  410. .content {
  411. padding: 24rpx;
  412. text-align: center;
  413. .u-checkbox[data-v-54acf820] {
  414. display: flex;
  415. justify-content: center;
  416. }
  417. }
  418. </style>