register_3.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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: left">
  37. <u-checkbox v-model="item.checked" v-for="(item, index) in allbrandList" :key="index" :name="item.brandCode" shape="circle">
  38. <view class="u-flex u-row-left" style="width: 150rpx;">
  39. {{item.brandCode}}
  40. </view>
  41. </u-checkbox>
  42. </u-checkbox-group>
  43. </view>
  44. </scroll-view>
  45. </view>
  46. </u-popup>
  47. <u-card v-if="this.form.cooperation.length" :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)"
  48. border-radius="20" :show-foot="false">
  49. <view slot="head">
  50. <view class="u-flex">
  51. <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
  52. 已选合作品牌
  53. </view>
  54. </view>
  55. <view slot="body" style="display:flex;width:100%;flex-flow: wrap;justify-content: space-around;align-items: center;">
  56. <view v-for="(item,index) in querybrandList" :key="index" style="width: 250rpx;">
  57. <u-image width="250rpx" :src="item.logUrl" mode="widthFix"></u-image>
  58. </view>
  59. </view>
  60. </u-card>
  61. <u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false"
  62. v-for="(item, index) in checkedAgentlist" :key="index">
  63. <view slot="head">
  64. <view class="u-flex u-row-between">
  65. <view class="u-flex">
  66. <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
  67. {{item.brand}}合作品牌签约任务
  68. </view>
  69. <view @click="delAgent(index)">
  70. <u-icon name="close" color="#666666" size="36"></u-icon>
  71. </view>
  72. </view>
  73. </view>
  74. <view slot="body">
  75. <u-form-item>
  76. <view style="margin-right: 10rpx;">
  77. <u-icon name="account" size="36"></u-icon>
  78. </view>
  79. <view class="">
  80. {{item.name}}
  81. </view>
  82. </u-form-item>
  83. <u-form-item prop="taskNum">
  84. <view style="margin-right: 10rpx;">
  85. <u-icon name="order" size="36"></u-icon>
  86. </view>
  87. <u-radio-group v-model="item.taskNum" :disabled="item.disabledGroup" @change="changeRadiogroup(item)">
  88. <u-radio @click.native.prevent="clickitem(item,i.signLv)" :label-disabled="i.labelDisabled" v-for="(i, index2) in tasknameList" :key="index2" :name="i.signLv">
  89. {{i.signLv}}
  90. </u-radio>
  91. </u-radio-group>
  92. </u-form-item>
  93. </view>
  94. </u-card>
  95. <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)"
  96. border-radius="20" :show-foot="false">
  97. <view slot="head">
  98. <view class="u-flex">
  99. <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
  100. 温馨提示
  101. </view>
  102. </view>
  103. <view slot="body" style="display:flex;width:100%;flex-flow: wrap;justify-content: space-around;align-items: center;">
  104. 此地区暂无此品牌的经销商
  105. </view>
  106. </u-card>
  107. <u-form-item :border-bottom="false">
  108. <view style="margin:0 30rpx;">
  109. <u-checkbox-group>
  110. <u-checkbox v-model="protocol">同意《用户协议》及《隐私政策》</u-checkbox>
  111. </u-checkbox-group>
  112. </view>
  113. </u-form-item>
  114. </u-form>
  115. <view style="margin:0 30rpx;">
  116. <u-button @click="nextStep" type="primary" @tap="$u.debounce(submit, 2000,immediate = true)" :loading="loading"
  117. :ripple="true" ripple-bg-color="#99d4ff">确认注册</u-button>
  118. </view>
  119. </view>
  120. </template>
  121. <script>
  122. import {
  123. request
  124. } from '../../common/request/request'
  125. require("promise.prototype.finally").shim()
  126. export default {
  127. data() {
  128. return {
  129. brandShow: false,
  130. loading: false,
  131. form: {
  132. cooperation: '',
  133. },
  134. formData: '',
  135. dataUrl: '',
  136. agentList: [], //经销商信息
  137. checkedAgentlist: [],
  138. taskList: [],
  139. tasknameList: [],
  140. brandAgentLvQueryList: [],
  141. rules: {
  142. cooperation: [{
  143. required: true,
  144. message: '请选择品牌',
  145. trigger: 'blur,change'
  146. }]
  147. },
  148. protocol: false,
  149. querybrandList: [],
  150. brandList: [],
  151. allbrandList:[]
  152. }
  153. },
  154. created() {
  155. uni.$on('formData', (data) => {
  156. this.formData = data.formData
  157. this.dataUrl = data.dataUrl
  158. })
  159. },
  160. mounted() {
  161. this.getAgentArea()
  162. this.getTasknum()
  163. this.getAllbrandlist()
  164. },
  165. methods: {
  166. getAgentArea() {
  167. uni.showLoading({
  168. title: '加载中...'
  169. });
  170. request({
  171. url: '/sailun/appStoreBasicInfo/getAgentArea',
  172. method: 'post',
  173. data: {
  174. "area": this.formData.district,
  175. "city": this.formData.city,
  176. "province": this.formData.province,
  177. // "area": "市北区",
  178. // "city": "青岛市",
  179. // "province": "山东省",
  180. "spart": "10",
  181. "vkorg": "8100",
  182. "vtweg": "10"
  183. }
  184. }).then(res => {
  185. if (res.data.code == 0) {
  186. this.agentList = res.data.Data.data
  187. this.agentList = this.agentList.reduce((res, item, index, array) => {
  188. for (let i = 0; i < array[index].regionBrandList.length; ++i) {
  189. res.push({
  190. brand: array[index].regionBrandList[i],
  191. brandCode: array[index].regionBrandList[i],
  192. name: item.name,
  193. kunnr: item.kunnr,
  194. agent_id: item.kunnr,
  195. taskNum: "",
  196. disabledGroup: false,
  197. checked:false,
  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.cooperations.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(function(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. } else {
  285. this.checkedAgentlist.filter(e => (e.brand === item.brand && e.agent_id != item.agent_id)).forEach(e => e.disabledGroup =
  286. true)
  287. }
  288. },
  289. clickitem (item,e) {
  290. if(item.checked==false){
  291. item.checked=true
  292. }else{
  293. item.checked=false
  294. item.taskNum=""
  295. }
  296. },
  297. getCooperation() {
  298. if (this.cooperations != null) {
  299. this.form.cooperation = this.cooperations.toString();
  300. this.checkedAgentlist = this.agentList.filter(item => this.cooperations.indexOf(item.brand) > -1)
  301. this.getQuerybrand()
  302. this.brandShow = false
  303. } else {
  304. console.log("至少选择一项")
  305. }
  306. },
  307. getTaskconfirm(e) {
  308. this.form.tasklist = e[0].label;
  309. },
  310. delAgent(index){
  311. this.checkedAgentlist.splice(index,1)
  312. },
  313. submit() {
  314. this.$refs.uForm.validate(valid => {
  315. if (valid) {
  316. this.brandAgentLvQueryList=this.checkedAgentlist.filter(item => (item.disabledGroup!=true))
  317. let checkenLength=this.checkedAgentlist.filter(item => (item.checked==true))
  318. if(checkenLength.length<this.brandAgentLvQueryList.length) return this.$u.toast('请完善任务条数');
  319. if (!this.protocol) return this.$u.toast('请勾选协议');
  320. this.setData()
  321. } else {
  322. console.log('验证失败');
  323. }
  324. });
  325. },
  326. setData() {
  327. this.brandAgentLvQueryList = this.brandAgentLvQueryList.reduce((res, item) => {
  328. res.push({
  329. agent_id: item.agent_id,
  330. agent_name: item.name,
  331. brand: item.brand,
  332. brandCode: item.brandCode,
  333. kunnr: item.kunnr,
  334. lvCount: parseInt(item.taskNum.substring(2)).toString(),
  335. showLv: item.taskNum,
  336. spart: "10",
  337. vkorg: "8100",
  338. vtweg: "10"
  339. })
  340. return res;
  341. }, []);
  342. let data = {
  343. "brandAgentLvQueryList": this.brandAgentLvQueryList,
  344. "city": this.formData.city,
  345. "contactName": this.formData.name,
  346. "district": this.formData.district,
  347. "jd": this.formData.longitude,
  348. "licenseUrl": this.dataUrl.licenseUrl,
  349. "mobileCode": this.formData.code,
  350. "province": this.formData.province,
  351. "storeImageUrl": this.dataUrl.storeUrl,
  352. "storeName": this.formData.store,
  353. "storePhone": this.formData.phone,
  354. "version": 1.00,
  355. "wd": this.formData.latitude,
  356. }
  357. request({
  358. url: '/sailun/appStoreBasicInfo/storeReg',
  359. method: 'post',
  360. data: data
  361. }).then(res => {
  362. if (res.data.code == 0) {
  363. this.loading = true
  364. this.$u.toast(res.data.msg);
  365. setTimeout(() => {
  366. this.$u.route({
  367. url: 'pages/login/index',
  368. })
  369. }, 2000)
  370. }
  371. if (res.data.code == 500) {
  372. this.$u.toast(res.data.msg);
  373. }
  374. }).catch(err => {
  375. console.log(err)
  376. }).finally(() => {
  377. this.loading = false
  378. })
  379. }
  380. },
  381. onReady() {
  382. this.$refs.uForm.setRules(this.rules);
  383. }
  384. }
  385. </script>
  386. <style lang="scss" scoped>
  387. .content {
  388. padding: 24rpx;
  389. text-align: center;
  390. .u-checkbox[data-v-54acf820] {
  391. display: flex;
  392. justify-content: center;
  393. }
  394. }
  395. </style>