register_3.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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. <scroll-view scroll-y="true" style="height: 300rpx;">
  35. <view class="u-flex u-row-center">
  36. <u-checkbox-group :wrap="true" @change="checkboxGroupChange" style="display: flex;justify-content: center">
  37. <u-checkbox v-model="item.checked" v-for="(item, index) in brandList" :key="index" :name="item.brand" shape="circle">
  38. <view class="u-flex u-row-left" style="width: 150rpx;">
  39. {{item.brand}}
  40. </view>
  41. </u-checkbox>
  42. </u-checkbox-group>
  43. </view>
  44. </scroll-view>
  45. </view>
  46. </u-popup>
  47. <u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false">
  48. <view slot="head">
  49. <view class="u-flex">
  50. <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
  51. 已选合作品牌
  52. </view>
  53. </view>
  54. <view slot="body" style="display:flex;width:100%;flex-flow: wrap;justify-content: space-around;align-items: center;">
  55. <view v-for="(item,index) in querybrandList" :key="index" style="width: 250rpx;">
  56. <u-image width="250rpx" :src="item.logUrl" mode="widthFix"></u-image>
  57. </view>
  58. </view>
  59. </u-card>
  60. <u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false"
  61. v-for="(item, index) in checkedAgentlist" :key="index">
  62. <view slot="head">
  63. <view class="u-flex">
  64. <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
  65. {{item.brand}}合作品牌签约任务
  66. </view>
  67. </view>
  68. <view slot="body">
  69. <u-form-item>
  70. <view style="margin-right: 10rpx;">
  71. <u-icon name="account" size="36"></u-icon>
  72. </view>
  73. <view class="">
  74. {{item.name}}
  75. </view>
  76. </u-form-item>
  77. <u-form-item prop="taskNum">
  78. <view style="margin-right: 10rpx;">
  79. <u-icon name="order" size="36"></u-icon>
  80. </view>
  81. <u-radio-group v-model="item.taskNum" :disabled="item.disabledGroup" @change="changeRadiogroup">
  82. <u-radio v-for="(i, index) in tasknameList" :key="index" :name="i.task">
  83. {{i.task}}
  84. </u-radio>
  85. </u-radio-group>
  86. </u-form-item>
  87. </view>
  88. </u-card>
  89. <u-form-item :border-bottom="false">
  90. <view style="margin:0 30rpx;">
  91. <u-checkbox-group>
  92. <u-checkbox v-model="protocol">同意《用户协议》及《隐私政策》</u-checkbox>
  93. </u-checkbox-group>
  94. </view>
  95. </u-form-item>
  96. </u-form>
  97. <view style="margin:0 30rpx;">
  98. <u-button @click="nextStep" type="primary" @tap="$u.debounce(submit, 2000,immediate = true)" :loading="loading"
  99. :ripple="true" ripple-bg-color="#99d4ff">确认注册</u-button>
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import {
  105. request
  106. } from '../../common/request/request'
  107. require("promise.prototype.finally").shim()
  108. export default {
  109. data() {
  110. return {
  111. brandShow: false,
  112. loading: false,
  113. form: {
  114. cooperation: '',
  115. },
  116. formData: '',
  117. dataUrl: '',
  118. agentList: [], //经销商信息
  119. checkedAgentlist: [],
  120. taskList: [],
  121. tasknameList: [],
  122. brandAgentLvQueryList: [],
  123. rules: {
  124. cooperation: [{
  125. required: true,
  126. message: '请选择品牌',
  127. trigger: 'blur,change'
  128. }]
  129. },
  130. protocol: false,
  131. querybrandList:[],
  132. brandList:[]
  133. }
  134. },
  135. created() {
  136. uni.$on('formData', (data) => {
  137. this.formData = data.formData
  138. this.dataUrl = data.dataUrl
  139. })
  140. },
  141. mounted() {
  142. this.getAgentArea()
  143. this.getTasknum()
  144. },
  145. methods: {
  146. getAgentArea() {
  147. console.log(this.formData)
  148. request({
  149. url: '/sailun/appStoreBasicInfo/getAgentArea',
  150. method: 'post',
  151. data:{
  152. "area": this.formData.district,
  153. "city": this.formData.city,
  154. "province": this.formData.province,
  155. // "area": "市北区",
  156. // "city": "青岛市",
  157. // "province": "山东省",
  158. "spart": "10",
  159. "vkorg": "8100",
  160. "vtweg": "10"
  161. }
  162. }).then(res => {
  163. if (res.data.code == 0) {
  164. this.agentList = res.data.Data.data
  165. this.agentList = this.agentList.reduce((res, item, index, array) => {
  166. for (let i = 0; i < array[index].regionBrandList.length; i++) {
  167. res.push({
  168. brand: array[index].regionBrandList[i],
  169. brandCode: array[index].regionBrandList[i],
  170. name: item.name,
  171. kunnr: item.kunnr,
  172. agent_id: item.kunnr,
  173. taskNum: "",
  174. disabledGroup:false,
  175. })
  176. }
  177. return res;
  178. }, []);
  179. this.brandList=this.agentList.reduce((res, item, index, array) => {
  180. res.push(item.brand)
  181. return res;
  182. }, []);
  183. this.brandList=[...new Set(this.brandList)]
  184. this.brandList=this.brandList.reduce((res, item, index, array) => {
  185. res.push({brand:item})
  186. return res;
  187. }, []);
  188. }
  189. if (res.data.code == 500) {
  190. this.$u.toast(res.data.msg);
  191. }
  192. return this.agentList
  193. }).catch(err => {
  194. console.log(err)
  195. }).finally(() => {
  196. })
  197. },
  198. getQuerybrand(){
  199. request({
  200. url: '/sailun/appStoreBasicInfo/queryBrand',
  201. method: 'get',
  202. data: {},
  203. }).then(res => {
  204. if (res.data.code == 0) {
  205. this.querybrandList=res.data.data
  206. this.querybrandList = this.querybrandList.filter(item => this.cooperations.indexOf(item.brandCode) > -1)
  207. console.log(this.querybrandList)
  208. }
  209. if (res.data.code == 500) {
  210. this.$u.toast(res.data.msg);
  211. }
  212. }).catch(err => {
  213. console.log(err)
  214. }).finally(() => {
  215. })
  216. },
  217. getTasknum() {
  218. request({
  219. url: '/sailun/appStoreBasicInfo/enum',
  220. method: 'get',
  221. data: {},
  222. }).then(res => {
  223. if (res.data.code == 0) {
  224. this.taskList = res.data.data
  225. this.tasknameList = this.taskList.reduce((res, item) => {
  226. res.push({
  227. task: item.signLv,
  228. })
  229. return res;
  230. }, []);
  231. }
  232. if (res.data.code == 500) {
  233. this.$u.toast(res.data.msg);
  234. }
  235. }).catch(err => {
  236. console.log(err)
  237. }).finally(() => {
  238. })
  239. },
  240. checkboxGroupChange(e) {
  241. this.cooperations = e
  242. },
  243. changeRadiogroup(){
  244. console.log(this.checkedAgentlist)
  245. // let repeat=[]
  246. // this.checkedAgentlist.reduce((res, item, index, array) => {
  247. // return repeat.push({brand:item.brand,taskNum:item.taskNum})
  248. // }, []);
  249. // let arrD = [];
  250. // const map = new Map();
  251. // repeat.forEach(v => { if (map.get(v.brand) && arrD.every(vD => vD.brand != v.brand)) {
  252. // arrD.push(v);
  253. // } else {
  254. // map.set(v.brand, v);
  255. // }
  256. // });
  257. // var zdys = (repeat|| []).findIndex((profile) => profile.brand === arrD[0].brand);
  258. // console.log(zdys);
  259. // repeat.forEach((item,index,array)=>{
  260. // if(!array[index].taskNum){
  261. // }
  262. // })
  263. },
  264. getCooperation() {
  265. if (this.cooperations != null) {
  266. this.form.cooperation = this.cooperations.toString();
  267. this.checkedAgentlist = this.agentList.filter(item => this.cooperations.indexOf(item.brand) > -1)
  268. this.getQuerybrand()
  269. this.brandShow = false
  270. } else {
  271. console.log("至少选择一项")
  272. }
  273. },
  274. getTaskconfirm(e) {
  275. this.form.tasklist = e[0].label;
  276. },
  277. submit() {
  278. this.$refs.uForm.validate(valid => {
  279. if (valid) {
  280. if(!this.protocol)return this.$u.toast('请勾选协议');
  281. console.log('验证通过');
  282. } else {
  283. console.log('验证失败');
  284. }
  285. });
  286. this.brandAgentLvQueryList = this.checkedAgentlist.reduce((res, item) => {
  287. res.push({
  288. agent_id: item.agent_id,
  289. agent_name:item.name,
  290. brand: item.brand,
  291. brandCode: item.brandCode,
  292. kunnr: item.kunnr,
  293. lvCount: parseInt(item.taskNum.substring(2)).toString(),
  294. showLv: item.taskNum,
  295. spart: "10",
  296. vkorg: "8100",
  297. vtweg: "10"
  298. })
  299. return res;
  300. }, []);
  301. let data = {
  302. "brandAgentLvQueryList":this.brandAgentLvQueryList,
  303. "city":this.formData.city,
  304. "contactName":this.formData.name,
  305. "district":this.formData.district,
  306. "jd":this.formData.longitude,
  307. "licenseUrl":this.dataUrl.licenseUrl,
  308. "mobileCode":this.formData.code,
  309. "province":this.formData.province,
  310. "storeImageUrl":this.dataUrl.storeUrl,
  311. "storeName":this.formData.store,
  312. "storePhone":this.formData.phone,
  313. "version":1.00,
  314. "wd":this.formData.latitude,
  315. }
  316. console.log(data)
  317. request({
  318. url: '/sailun/appStoreBasicInfo/storeReg',
  319. method: 'post',
  320. data: data
  321. }).then(res => {
  322. console.log(res)
  323. if (res.data.code == 0) {
  324. this.loading = true
  325. this.$u.toast(res.data.msg);
  326. setTimeout(() => {
  327. this.$u.route({
  328. url: 'pages/login/index',
  329. })
  330. }, 2000)
  331. }
  332. if (res.data.code == 500) {
  333. this.$u.toast(res.data.msg);
  334. }
  335. }).catch(err => {
  336. console.log(err)
  337. }).finally(() => {
  338. this.loading = false
  339. })
  340. },
  341. },
  342. onReady() {
  343. this.$refs.uForm.setRules(this.rules);
  344. }
  345. }
  346. </script>
  347. <style lang="scss" scoped>
  348. .content {
  349. padding: 24rpx;
  350. text-align: center;
  351. .u-checkbox[data-v-54acf820] {
  352. display: flex;
  353. justify-content: center;
  354. }
  355. }
  356. </style>