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. this.getAgentArea()
  141. this.getTasknum()
  142. },
  143. methods: {
  144. getAgentArea() {
  145. let data={
  146. "area": this.formData.district,
  147. "city": this.formData.city,
  148. "province": this.formData.province,
  149. // "area": "市北区",
  150. // "city": "青岛市",
  151. // "province": "山东省",
  152. "spart": "10",
  153. "vkorg": "8100",
  154. "vtweg": "10"
  155. }
  156. console.log(data)
  157. request({
  158. url: '/sailun/appStoreBasicInfo/getAgentArea',
  159. method: 'post',
  160. data: data
  161. }).then(res => {
  162. if (res.data.code == 0) {
  163. this.agentList = res.data.Data.data
  164. this.agentList = this.agentList.reduce((res, item, index, array) => {
  165. for (let i = 0; i < array[index].regionBrandList.length; i++) {
  166. res.push({
  167. brand: array[index].regionBrandList[i],
  168. brandCode: array[index].regionBrandList[i],
  169. name: item.name,
  170. kunnr: item.kunnr,
  171. agent_id: item.kunnr,
  172. taskNum: "",
  173. disabledGroup:false,
  174. })
  175. }
  176. return res;
  177. }, []);
  178. this.brandList=this.agentList.reduce((res, item, index, array) => {
  179. res.push(item.brand)
  180. return res;
  181. }, []);
  182. this.brandList=[...new Set(this.brandList)]
  183. this.brandList=this.brandList.reduce((res, item, index, array) => {
  184. res.push({brand:item})
  185. return res;
  186. }, []);
  187. }
  188. if (res.data.code == 500) {
  189. this.$u.toast(res.data.msg);
  190. }
  191. return this.agentList
  192. }).catch(err => {
  193. console.log(err)
  194. }).finally(() => {
  195. })
  196. },
  197. getQuerybrand(){
  198. request({
  199. url: '/sailun/appStoreBasicInfo/queryBrand',
  200. method: 'get',
  201. data: {},
  202. }).then(res => {
  203. if (res.data.code == 0) {
  204. this.querybrandList=res.data.data
  205. this.querybrandList = this.querybrandList.filter(item => this.cooperations.indexOf(item.brandCode) > -1)
  206. console.log(this.querybrandList)
  207. }
  208. if (res.data.code == 500) {
  209. this.$u.toast(res.data.msg);
  210. }
  211. }).catch(err => {
  212. console.log(err)
  213. }).finally(() => {
  214. })
  215. },
  216. getTasknum() {
  217. request({
  218. url: '/sailun/appStoreBasicInfo/enum',
  219. method: 'get',
  220. data: {},
  221. }).then(res => {
  222. if (res.data.code == 0) {
  223. this.taskList = res.data.data
  224. this.tasknameList = this.taskList.reduce((res, item) => {
  225. res.push({
  226. task: item.signLv,
  227. })
  228. return res;
  229. }, []);
  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. checkboxGroupChange(e) {
  240. this.cooperations = e
  241. },
  242. changeRadiogroup(){
  243. console.log(this.checkedAgentlist)
  244. // let repeat=[]
  245. // this.checkedAgentlist.reduce((res, item, index, array) => {
  246. // return repeat.push({brand:item.brand,taskNum:item.taskNum})
  247. // }, []);
  248. // let arrD = [];
  249. // const map = new Map();
  250. // repeat.forEach(v => { if (map.get(v.brand) && arrD.every(vD => vD.brand != v.brand)) {
  251. // arrD.push(v);
  252. // } else {
  253. // map.set(v.brand, v);
  254. // }
  255. // });
  256. // var zdys = (repeat|| []).findIndex((profile) => profile.brand === arrD[0].brand);
  257. // console.log(zdys);
  258. // repeat.forEach((item,index,array)=>{
  259. // if(!array[index].taskNum){
  260. // }
  261. // })
  262. },
  263. getCooperation() {
  264. if (this.cooperations != null) {
  265. this.form.cooperation = this.cooperations.toString();
  266. this.checkedAgentlist = this.agentList.filter(item => this.cooperations.indexOf(item.brand) > -1)
  267. this.getQuerybrand()
  268. this.brandShow = false
  269. } else {
  270. console.log("至少选择一项")
  271. }
  272. },
  273. getTaskconfirm(e) {
  274. this.form.tasklist = e[0].label;
  275. },
  276. submit() {
  277. this.$refs.uForm.validate(valid => {
  278. if (valid) {
  279. if(!this.protocol)return this.$u.toast('请勾选协议');
  280. console.log('验证通过');
  281. } else {
  282. console.log('验证失败');
  283. }
  284. });
  285. this.brandAgentLvQueryList = this.checkedAgentlist.reduce((res, item) => {
  286. res.push({
  287. agent_id: item.agent_id,
  288. agent_name:item.name,
  289. brand: item.brand,
  290. brandCode: item.brandCode,
  291. kunnr: item.kunnr,
  292. lvCount: parseInt(item.taskNum.substring(2)).toString(),
  293. showLv: item.taskNum,
  294. spart: "10",
  295. vkorg: "8100",
  296. vtweg: "10"
  297. })
  298. return res;
  299. }, []);
  300. let data = {
  301. "brandAgentLvQueryList":this.brandAgentLvQueryList,
  302. "city":this.formData.city,
  303. "contactName":this.formData.name,
  304. "district":this.formData.district,
  305. "jd":this.formData.longitude,
  306. "licenseUrl":this.dataUrl.licenseUrl,
  307. "mobileCode":this.formData.code,
  308. "province":this.formData.province,
  309. "storeImageUrl":this.dataUrl.storeUrl,
  310. "storeName":this.formData.store,
  311. "storePhone":this.formData.phone,
  312. "version":1.00,
  313. "wd":this.formData.latitude,
  314. }
  315. console.log(data)
  316. request({
  317. url: '/sailun/appStoreBasicInfo/storeReg',
  318. method: 'post',
  319. data: data
  320. }).then(res => {
  321. console.log(res)
  322. if (res.data.code == 0) {
  323. this.loading = true
  324. this.$u.toast(res.data.msg);
  325. setTimeout(() => {
  326. this.$u.route({
  327. url: 'pages/login/index',
  328. })
  329. }, 2000)
  330. }
  331. if (res.data.code == 500) {
  332. this.$u.toast(res.data.msg);
  333. }
  334. }).catch(err => {
  335. console.log(err)
  336. }).finally(() => {
  337. this.loading = false
  338. })
  339. },
  340. },
  341. onReady() {
  342. this.$refs.uForm.setRules(this.rules);
  343. }
  344. }
  345. </script>
  346. <style lang="scss" scoped>
  347. .content {
  348. padding: 24rpx;
  349. text-align: center;
  350. .u-checkbox[data-v-54acf820] {
  351. display: flex;
  352. justify-content: center;
  353. }
  354. }
  355. </style>