register_3.vue 9.9 KB

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