register_3.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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;" class="u-flex">
  107. <u-checkbox-group>
  108. <u-checkbox v-model="protocol">
  109. </u-checkbox>
  110. </u-checkbox-group>
  111. <view class="u-flex">
  112. 同意
  113. <view class="" @click="openPdf(1)">
  114. 《用户协议》
  115. </view>
  116. <view class="" @click="openPdf(2)">
  117. 《隐私政策》
  118. </view>
  119. </view>
  120. </view>
  121. </u-form-item>
  122. </u-form>
  123. <view style="margin:0 30rpx 30rpx 30rpx">
  124. <u-button @click="submit" type="primary" :loading="loading" :ripple="true" ripple-bg-color="#99d4ff">确认注册</u-button>
  125. </view>
  126. </view>
  127. </template>
  128. <script>
  129. import {
  130. request
  131. } from '../../common/request/request'
  132. require("promise.prototype.finally").shim()
  133. export default {
  134. data() {
  135. return {
  136. brandShow: false,
  137. loading: false,
  138. form: {
  139. cooperation: '',
  140. },
  141. formData: '',
  142. dataUrl: '',
  143. agentList: [], //经销商信息
  144. checkedAgentlist: [],
  145. taskList: [],
  146. tasknameList: [],
  147. brandAgentLvQueryList: [],
  148. rules: {
  149. cooperation: [{
  150. required: true,
  151. message: '请选择品牌',
  152. trigger: 'blur,change'
  153. }]
  154. },
  155. protocol: false,
  156. querybrandList: [],
  157. // brandList: [],
  158. allbrandList: [], //弹出窗获取brand数组
  159. checkedBrandlist: [], //选中brand组成一个新数组
  160. appStoreBusinessLicenseDto: ''
  161. }
  162. },
  163. created() {
  164. uni.$on('formData', (data) => {
  165. this.formData = data.formData
  166. this.dataUrl = data.dataUrl
  167. })
  168. this.getAllbrandlist()
  169. },
  170. mounted() {
  171. this.getAgentArea()
  172. this.getTasknum()
  173. },
  174. methods: {
  175. openPdf(x) {
  176. if(x==1){
  177. uni.openDocument({
  178. filePath: '../../static/pdf/xy.pdf',
  179. });
  180. }else{
  181. uni.openDocument({
  182. filePath: '../../static/pdf/zc.pdf',
  183. });
  184. }
  185. },
  186. getAgentArea() {
  187. uni.showLoading({
  188. title: '加载中...'
  189. });
  190. request({
  191. url: '/sailun/appStoreBasicInfo/getAgentArea',
  192. method: 'post',
  193. data: {
  194. "area": this.formData.district,
  195. "city": this.formData.city,
  196. "province": this.formData.province,
  197. // "area": "李沧区",
  198. // "city": "青岛市",
  199. // "province": "山东省",
  200. "spart": "10",
  201. "vkorg": "8100",
  202. "vtweg": "10"
  203. }
  204. }).then(res => {
  205. if (res.data.code == 0) {
  206. this.agentList = res.data.Data.data
  207. this.agentList = this.agentList.reduce((res, item, index, array) => {
  208. for (let i = 0; i < array[index].regionBrandList.length; i++) {
  209. res.push({
  210. brand: array[index].regionBrandList[i],
  211. brandCode: array[index].regionBrandList[i],
  212. name: item.name,
  213. kunnr: item.kunnr,
  214. agent_id: item.kunnr,
  215. taskNum: "",
  216. disabledGroup: false,
  217. checked: false,
  218. seriesCode: ""
  219. })
  220. }
  221. return res;
  222. }, []);
  223. // this.brandList = [...new Set(this.agentList.reduce((res, item, index, array) => {
  224. // res.push(item.brand)
  225. // return res;
  226. // }, []))].reduce((res, item, index, array) => {
  227. // res.push({
  228. // brand: item
  229. // })
  230. // return res;
  231. // }, []);
  232. }
  233. if (res.data.code == 500) {
  234. this.$u.toast(res.data.msg);
  235. }
  236. return this.agentList
  237. }).catch(err => {
  238. }).finally(() => {
  239. uni.hideLoading()
  240. })
  241. },
  242. getAllbrandlist() {
  243. request({
  244. url: '/sailun/appStoreBasicInfo/queryBrand',
  245. method: 'get',
  246. data: {},
  247. }).then(res => {
  248. if (res.data.code == 0) {
  249. this.allbrandList = res.data.data
  250. }
  251. if (res.data.code == 500) {
  252. this.$u.toast(res.data.msg);
  253. }
  254. }).catch(err => {
  255. }).finally(() => {
  256. })
  257. },
  258. getQuerybrand() {
  259. request({
  260. url: '/sailun/appStoreBasicInfo/queryBrand',
  261. method: 'get',
  262. data: {},
  263. }).then(res => {
  264. if (res.data.code == 0) {
  265. this.querybrandList = res.data.data
  266. this.querybrandList = this.querybrandList.filter(item => this.checkedBrandlist.indexOf(item.brandCode) > -1)
  267. }
  268. if (res.data.code == 500) {
  269. this.$u.toast(res.data.msg);
  270. }
  271. }).catch(err => {
  272. }).finally(() => {
  273. })
  274. },
  275. getTasknum() {
  276. request({
  277. url: '/sailun/appStoreBasicInfo/enum',
  278. method: 'get',
  279. data: {},
  280. }).then(res => {
  281. if (res.data.code == 0) {
  282. res.data.data.map((item, index) => {
  283. item.checked = false;
  284. })
  285. this.tasknameList = res.data.data
  286. }
  287. if (res.data.code == 500) {
  288. this.$u.toast(res.data.msg);
  289. }
  290. }).catch(err => {
  291. }).finally(() => {
  292. })
  293. },
  294. checkboxGroupChange(e) {
  295. this.cooperations = e
  296. },
  297. changeRadiogroup(item) {
  298. if (item.checked == true) {
  299. this.checkedAgentlist.filter(e => (e.brand === item.brand && e.agent_id != item.agent_id)).forEach(e => e.disabledGroup =
  300. false)
  301. this.checkedAgentlist.filter(e => (e.seriesCode === item.seriesCode && e.agent_id != item.agent_id)).forEach(e =>
  302. e.disabledGroup =
  303. false)
  304. } else {
  305. this.checkedAgentlist.filter(e => (e.brand === item.brand && e.agent_id != item.agent_id)).forEach(e => e.disabledGroup =
  306. true)
  307. this.checkedAgentlist.filter(e => (e.seriesCode === item.seriesCode && e.agent_id != item.agent_id)).forEach(e =>
  308. e.disabledGroup =
  309. true)
  310. }
  311. },
  312. clickitem(item, e) {
  313. if (item.checked == false) {
  314. item.checked = true
  315. } else {
  316. item.checked = false
  317. item.taskNum = ""
  318. }
  319. },
  320. getCooperation() {
  321. if (this.cooperations != null) {
  322. this.form.cooperation = this.cooperations.toString();
  323. this.allbrandList.map(item => {
  324. this.agentList.map(e => {
  325. if (e.brand == item.brandCode) {
  326. e.seriesCode = item.seriesCode
  327. }
  328. })
  329. })
  330. this.checkedAgentlist = this.agentList.filter(item => this.cooperations.indexOf(item.brand) > -1)
  331. this.checkedBrandlist = this.checkedAgentlist.reduce((res, item, index, array) => {
  332. res.push(item.brand)
  333. return res;
  334. }, []);
  335. this.checkedAgentlist.sort((a, b) => {
  336. return a['brand'].localeCompare(b['brand'])
  337. })
  338. this.getQuerybrand()
  339. this.brandShow = false
  340. } else {
  341. }
  342. },
  343. getTaskconfirm(e) {
  344. this.form.tasklist = e[0].label;
  345. },
  346. delAgent(index) {
  347. this.checkedAgentlist.splice(index, 1)
  348. },
  349. submit() {
  350. this.$refs.uForm.validate(valid => {
  351. if (valid) {
  352. this.brandAgentLvQueryList = this.checkedAgentlist.filter(item => (item.disabledGroup != true))
  353. let checkenLength = this.checkedAgentlist.filter(item => (item.checked == false && item.disabledGroup == false))
  354. if (!this.brandAgentLvQueryList.length) return this.$u.toast('未正确选择经销商,请正确选择');
  355. if (checkenLength.length != 0) return this.$u.toast('请选择' + checkenLength[0].brand + "品牌签约任务");
  356. if (!this.protocol) return this.$u.toast('请阅读并同意用户协议和隐私协议');
  357. this.setData()
  358. } else {
  359. }
  360. });
  361. },
  362. setData() {
  363. this.brandAgentLvQueryList = this.brandAgentLvQueryList.reduce((res, item) => {
  364. res.push({
  365. agent_id: item.agent_id,
  366. agent_name: item.name,
  367. brand: item.brand,
  368. brandCode: item.brandCode,
  369. kunnr: item.kunnr,
  370. lvCount: parseInt(item.taskNum.substring(2)).toString(),
  371. showLv: item.taskNum,
  372. spart: "10",
  373. vkorg: "8100",
  374. vtweg: "10"
  375. })
  376. return res;
  377. }, []);
  378. let data = {
  379. "appStoreBusinessLicenseDto": this.dataUrl.appStoreBusinessLicenseDto,
  380. "brandAgentLvQueryList": this.brandAgentLvQueryList,
  381. "city": this.formData.city,
  382. "contactName": this.formData.name,
  383. "district": this.formData.district,
  384. "jd": this.formData.longitude,
  385. "licenseUrl": this.dataUrl.licenseUrl,
  386. "mobileCode": this.formData.code,
  387. "province": this.formData.province,
  388. "storeImageUrl": this.dataUrl.storeUrl,
  389. "storeName": this.formData.store,
  390. "storePhone": this.formData.phone,
  391. "version": 1.00,
  392. "wd": this.formData.latitude,
  393. "addressInfo": this.formData.addressInfo
  394. }
  395. this.loading = true
  396. request({
  397. url: '/sailun/appStoreBasicInfo/storeReg',
  398. method: 'post',
  399. data: data
  400. }).then(res => {
  401. if (res.data.code == 0) {
  402. this.$u.toast("注册资料已提交成功");
  403. setTimeout(() => {
  404. this.$u.route({
  405. url: 'pages/login/index',
  406. })
  407. uni.$emit('loginphone', this.formData.phone)
  408. }, 2000)
  409. }
  410. if (res.data.code == 500) {
  411. this.$u.toast(res.data.msg);
  412. }
  413. }).catch(err => {
  414. }).finally(() => {
  415. setTimeout(() => {
  416. this.loading = false
  417. }, 2000)
  418. })
  419. }
  420. },
  421. onReady() {
  422. this.$refs.uForm.setRules(this.rules);
  423. }
  424. }
  425. </script>
  426. <style lang="scss" scoped>
  427. .content {
  428. padding: 24rpx;
  429. text-align: center;
  430. .u-checkbox[data-v-54acf820] {
  431. display: flex;
  432. justify-content: center;
  433. }
  434. }
  435. </style>