register_3.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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(xy)">
  114. 《用户协议》
  115. </view>
  116. <view class="" @click="openPdf(zc)">
  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=='xy'){
  177. uni.openDocument({
  178. filePath: '../../static/pdf/xy.pdf',
  179. success: function(res) {
  180. console.log('打开文档成功');
  181. }
  182. });
  183. }else{
  184. uni.openDocument({
  185. filePath: '../../static/pdf/zc.pdf',
  186. success: function(res) {
  187. console.log('打开文档成功');
  188. }
  189. });
  190. }
  191. },
  192. getAgentArea() {
  193. uni.showLoading({
  194. title: '加载中...'
  195. });
  196. request({
  197. url: '/sailun/appStoreBasicInfo/getAgentArea',
  198. method: 'post',
  199. data: {
  200. "area": this.formData.district,
  201. "city": this.formData.city,
  202. "province": this.formData.province,
  203. // "area": "李沧区",
  204. // "city": "青岛市",
  205. // "province": "山东省",
  206. "spart": "10",
  207. "vkorg": "8100",
  208. "vtweg": "10"
  209. }
  210. }).then(res => {
  211. if (res.data.code == 0) {
  212. this.agentList = res.data.Data.data
  213. this.agentList = this.agentList.reduce((res, item, index, array) => {
  214. for (let i = 0; i < array[index].regionBrandList.length; i++) {
  215. res.push({
  216. brand: array[index].regionBrandList[i],
  217. brandCode: array[index].regionBrandList[i],
  218. name: item.name,
  219. kunnr: item.kunnr,
  220. agent_id: item.kunnr,
  221. taskNum: "",
  222. disabledGroup: false,
  223. checked: false,
  224. seriesCode: ""
  225. })
  226. }
  227. return res;
  228. }, []);
  229. // this.brandList = [...new Set(this.agentList.reduce((res, item, index, array) => {
  230. // res.push(item.brand)
  231. // return res;
  232. // }, []))].reduce((res, item, index, array) => {
  233. // res.push({
  234. // brand: item
  235. // })
  236. // return res;
  237. // }, []);
  238. }
  239. if (res.data.code == 500) {
  240. this.$u.toast(res.data.msg);
  241. }
  242. return this.agentList
  243. }).catch(err => {
  244. console.log(err)
  245. }).finally(() => {
  246. uni.hideLoading()
  247. })
  248. },
  249. getAllbrandlist() {
  250. request({
  251. url: '/sailun/appStoreBasicInfo/queryBrand',
  252. method: 'get',
  253. data: {},
  254. }).then(res => {
  255. if (res.data.code == 0) {
  256. this.allbrandList = res.data.data
  257. }
  258. if (res.data.code == 500) {
  259. this.$u.toast(res.data.msg);
  260. }
  261. }).catch(err => {
  262. console.log(err)
  263. }).finally(() => {
  264. })
  265. },
  266. getQuerybrand() {
  267. request({
  268. url: '/sailun/appStoreBasicInfo/queryBrand',
  269. method: 'get',
  270. data: {},
  271. }).then(res => {
  272. if (res.data.code == 0) {
  273. this.querybrandList = res.data.data
  274. this.querybrandList = this.querybrandList.filter(item => this.checkedBrandlist.indexOf(item.brandCode) > -1)
  275. }
  276. if (res.data.code == 500) {
  277. this.$u.toast(res.data.msg);
  278. }
  279. }).catch(err => {
  280. console.log(err)
  281. }).finally(() => {
  282. })
  283. },
  284. getTasknum() {
  285. request({
  286. url: '/sailun/appStoreBasicInfo/enum',
  287. method: 'get',
  288. data: {},
  289. }).then(res => {
  290. if (res.data.code == 0) {
  291. res.data.data.map((item, index) => {
  292. item.checked = false;
  293. })
  294. this.tasknameList = res.data.data
  295. }
  296. if (res.data.code == 500) {
  297. this.$u.toast(res.data.msg);
  298. }
  299. }).catch(err => {
  300. console.log(err)
  301. }).finally(() => {
  302. })
  303. },
  304. checkboxGroupChange(e) {
  305. this.cooperations = e
  306. },
  307. changeRadiogroup(item) {
  308. if (item.checked == true) {
  309. this.checkedAgentlist.filter(e => (e.brand === item.brand && e.agent_id != item.agent_id)).forEach(e => e.disabledGroup =
  310. false)
  311. this.checkedAgentlist.filter(e => (e.seriesCode === item.seriesCode && e.agent_id != item.agent_id)).forEach(e =>
  312. e.disabledGroup =
  313. false)
  314. } else {
  315. this.checkedAgentlist.filter(e => (e.brand === item.brand && e.agent_id != item.agent_id)).forEach(e => e.disabledGroup =
  316. true)
  317. this.checkedAgentlist.filter(e => (e.seriesCode === item.seriesCode && e.agent_id != item.agent_id)).forEach(e =>
  318. e.disabledGroup =
  319. true)
  320. }
  321. },
  322. clickitem(item, e) {
  323. if (item.checked == false) {
  324. item.checked = true
  325. } else {
  326. item.checked = false
  327. item.taskNum = ""
  328. }
  329. },
  330. getCooperation() {
  331. if (this.cooperations != null) {
  332. this.form.cooperation = this.cooperations.toString();
  333. this.allbrandList.map(item => {
  334. this.agentList.map(e => {
  335. if (e.brand == item.brandCode) {
  336. e.seriesCode = item.seriesCode
  337. }
  338. })
  339. })
  340. this.checkedAgentlist = this.agentList.filter(item => this.cooperations.indexOf(item.brand) > -1)
  341. this.checkedBrandlist = this.checkedAgentlist.reduce((res, item, index, array) => {
  342. res.push(item.brand)
  343. return res;
  344. }, []);
  345. this.checkedAgentlist.sort((a, b) => {
  346. return a['brand'].localeCompare(b['brand'])
  347. })
  348. this.getQuerybrand()
  349. this.brandShow = false
  350. } else {
  351. console.log("至少选择一项")
  352. }
  353. },
  354. getTaskconfirm(e) {
  355. this.form.tasklist = e[0].label;
  356. },
  357. delAgent(index) {
  358. this.checkedAgentlist.splice(index, 1)
  359. },
  360. submit() {
  361. this.$refs.uForm.validate(valid => {
  362. if (valid) {
  363. this.brandAgentLvQueryList = this.checkedAgentlist.filter(item => (item.disabledGroup != true))
  364. let checkenLength = this.checkedAgentlist.filter(item => (item.checked == false && item.disabledGroup == false))
  365. if (!this.brandAgentLvQueryList.length) return this.$u.toast('未正确选择经销商,请正确选择');
  366. if (checkenLength.length != 0) return this.$u.toast('请选择' + checkenLength[0].brand + "品牌签约任务");
  367. if (!this.protocol) return this.$u.toast('请阅读并同意用户协议和隐私协议');
  368. this.setData()
  369. } else {
  370. console.log('验证失败');
  371. }
  372. });
  373. },
  374. setData() {
  375. this.brandAgentLvQueryList = this.brandAgentLvQueryList.reduce((res, item) => {
  376. res.push({
  377. agent_id: item.agent_id,
  378. agent_name: item.name,
  379. brand: item.brand,
  380. brandCode: item.brandCode,
  381. kunnr: item.kunnr,
  382. lvCount: parseInt(item.taskNum.substring(2)).toString(),
  383. showLv: item.taskNum,
  384. spart: "10",
  385. vkorg: "8100",
  386. vtweg: "10"
  387. })
  388. return res;
  389. }, []);
  390. let data = {
  391. "appStoreBusinessLicenseDto": this.dataUrl.appStoreBusinessLicenseDto,
  392. "brandAgentLvQueryList": this.brandAgentLvQueryList,
  393. "city": this.formData.city,
  394. "contactName": this.formData.name,
  395. "district": this.formData.district,
  396. "jd": this.formData.longitude,
  397. "licenseUrl": this.dataUrl.licenseUrl,
  398. "mobileCode": this.formData.code,
  399. "province": this.formData.province,
  400. "storeImageUrl": this.dataUrl.storeUrl,
  401. "storeName": this.formData.store,
  402. "storePhone": this.formData.phone,
  403. "version": 1.00,
  404. "wd": this.formData.latitude,
  405. "addressInfo": this.formData.addressInfo
  406. }
  407. this.loading = true
  408. request({
  409. url: '/sailun/appStoreBasicInfo/storeReg',
  410. method: 'post',
  411. data: data
  412. }).then(res => {
  413. if (res.data.code == 0) {
  414. this.$u.toast("注册资料已提交成功");
  415. setTimeout(() => {
  416. this.$u.route({
  417. url: 'pages/login/index',
  418. })
  419. uni.$emit('loginphone', this.formData.phone)
  420. }, 2000)
  421. }
  422. if (res.data.code == 500) {
  423. this.$u.toast(res.data.msg);
  424. }
  425. }).catch(err => {
  426. console.log(err)
  427. }).finally(() => {
  428. setTimeout(() => {
  429. this.loading = false
  430. }, 2000)
  431. })
  432. }
  433. },
  434. onReady() {
  435. this.$refs.uForm.setRules(this.rules);
  436. }
  437. }
  438. </script>
  439. <style lang="scss" scoped>
  440. .content {
  441. padding: 24rpx;
  442. text-align: center;
  443. .u-checkbox[data-v-54acf820] {
  444. display: flex;
  445. justify-content: center;
  446. }
  447. }
  448. </style>