register_3.vue 9.9 KB

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