register_3.vue 9.1 KB

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