bindinfo.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326
  1. <template>
  2. <view style="position: relative;">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view class="home" style="padding-top: 180rpx;">
  6. <view style="margin: 0 20rpx;">
  7. <uni-forms :rules="rules" :value="formData" ref="form" validate-trigger="bind"
  8. err-show-type="undertext">
  9. <view class="title">
  10. <p>个人资料</p>
  11. </view>
  12. <uni-forms-item name="age" label="年龄区间">
  13. <picker @change="bindPickerChange" :value="index" :range="array"
  14. range-key="age_bracket_discribe">
  15. <view>{{ Xage }}</view>
  16. </picker>
  17. </uni-forms-item>
  18. <uni-forms-item name="skintype" label="国籍">
  19. <picker @change="bindPickerChange1" :value="index1" :range="array1" range-key="name">
  20. <view>{{ array1[index1].name }}</view>
  21. </picker>
  22. </uni-forms-item>
  23. <uni-forms-item name="vregion" label="探店地区">
  24. <picker class="picker" mode="multiSelector" :range="region" range-key="name"
  25. :value="regionIndex" @change="pickerChange" @columnchange="pickerColumnchange">
  26. <view class="pbox" :class="{'pbox_hover':regionStr != '请选择省市区'}">
  27. <view>{{regionStr}}</view>
  28. <text class="iconfont icon-you"></text>
  29. </view>
  30. </picker>
  31. </uni-forms-item>
  32. <uni-forms-item name="phone" required label="联系电话">
  33. <uni-easyinput type="number" maxlength="11" :inputBorder="true" v-model="formData.phone"
  34. placeholder="请输入联系电话">
  35. </uni-easyinput>
  36. </uni-forms-item>
  37. <view class="line"></view>
  38. <view class="title">
  39. <p>收货地址</p>
  40. </view>
  41. <uni-forms-item name="name" required label="收件人">
  42. <uni-easyinput type="text" :inputBorder="true" v-model="formData.name" placeholder="请输入收件人">
  43. </uni-easyinput>
  44. </uni-forms-item>
  45. <uni-forms-item name="tel" required label="联系电话">
  46. <uni-easyinput type="number" maxlength="11" :inputBorder="true" v-model="formData.tel"
  47. placeholder="请输入联系电话">
  48. </uni-easyinput>
  49. </uni-forms-item>
  50. <uni-forms-item name="fregion" required label="所在地区">
  51. <picker class="picker" mode="multiSelector" :range="region" range-key="name"
  52. :value="regionIndex1" @change="pickerChange1" @columnchange="pickerColumnchange1">
  53. <view class="pbox" :class="{'pbox_hover':regionStr1 != '请选择省市区'}">
  54. <view>{{regionStr1}}</view>
  55. <text class="iconfont icon-you"></text>
  56. </view>
  57. </picker>
  58. </uni-forms-item>
  59. <uni-forms-item name="detailregion" required label="详细地址">
  60. <uni-easyinput type="text" :inputBorder="true" v-model="formData.detailregion"
  61. placeholder="请输入详细地址(省/市/县/镇/)">
  62. </uni-easyinput>
  63. </uni-forms-item>
  64. <view class="setdeault">
  65. <view class="setdeault-text">设为默认收货地址</view>
  66. <switch style='zoom:.8;' @change="setDefault" />
  67. </view>
  68. <view class="line"></view>
  69. <view class="title">
  70. <p>{{platform.platform_name}}账号</p>
  71. </view>
  72. <uni-forms-item name="nickname" required label="昵称">
  73. <uni-easyinput type="text" v-model="formData.platform_nickname" placeholder="请填写账号昵称">
  74. </uni-easyinput>
  75. </uni-forms-item>
  76. <uni-forms-item name="numberfans" required label="粉丝数">
  77. <uni-easyinput type="number" v-model="formData.fans_count" placeholder="请填写粉丝数量">
  78. </uni-easyinput>
  79. </uni-forms-item>
  80. <uni-forms-item name="home_link" required label=" " label-width='10'>
  81. <uni-easyinput class="home-link" type="text" v-model="formData.home_page_url"
  82. placeholder="请填写个人主页链接">
  83. </uni-easyinput>
  84. </uni-forms-item>
  85. <view style="margin-top: 40rpx;">
  86. <uni-forms-item name="home_img" required label="主页截图">
  87. <htz-image-upload :max="1" mediaType="image" name="file" :chooseNum="1" v-model="imageData"
  88. @chooseSuccess="ceshiChooseSuccess">
  89. </htz-image-upload>
  90. </uni-forms-item>
  91. </view>
  92. </uni-forms>
  93. </view>
  94. </view>
  95. <button class="btn1" @click="submitForm('form')">保存</button>
  96. </view>
  97. </template>
  98. <script>
  99. import region from '@/components/pca-code.json';
  100. import mvBar from "@/components/mys_navBar/mysNavBar";
  101. import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue';
  102. import getPolicyEncode from '@/components/obs/getPolicy.js';
  103. import getSignature from '@/components/obs/GetSignature.js';
  104. export default {
  105. components: {
  106. mvBar,
  107. htzImageUpload,
  108. },
  109. data() {
  110. return {
  111. address: [],
  112. accountId: '',
  113. platform: {
  114. platform_id: '',
  115. platform_name: '',
  116. platform_icon: '',
  117. },
  118. isBind: true,
  119. imageData: [],
  120. ismodify: '',
  121. // 原数组
  122. oldRegion: region,
  123. // 处理后的数组
  124. region: [
  125. [],
  126. [],
  127. []
  128. ],
  129. // 选择省市区的下标Index 传则默认选中传递的
  130. regionIndex: [0, 0, 0],
  131. regionIndex1: [0, 0, 0],
  132. // 省市区字符串
  133. regionStr: '请选择省市区',
  134. regionStr1: '请选择省市区',
  135. formData: {
  136. age: '',
  137. nationality: '',
  138. phone: '',
  139. visitStoreRegion: '',
  140. name: '',
  141. tel: '',
  142. detailregion: '',
  143. fregion: '',
  144. setdefault: false,
  145. platform_nickname: '',
  146. fans_count: '',
  147. home_page_url: '',
  148. },
  149. index: 0,
  150. index1: 0,
  151. Xage: '请选择',
  152. Xskintype: '请选择',
  153. array: [{
  154. age_bracket_discribe: '请选择',
  155. age_aid: 0
  156. }, {
  157. age_bracket_discribe: '0~18',
  158. age_aid: 1
  159. }, {
  160. age_bracket_discribe: '18~25',
  161. age_aid: 2
  162. }, {
  163. age_bracket_discribe: '26~30',
  164. age_aid: 3
  165. }, {
  166. age_bracket_discribe: '30~40',
  167. age_aid: 4
  168. }, {
  169. age_bracket_discribe: '40+',
  170. age_aid: 5
  171. }],
  172. array1: [{
  173. name: '请选择',
  174. id: 0
  175. }, {
  176. name: '中国',
  177. id: 1
  178. }, {
  179. name: '外国',
  180. id: 2
  181. }],
  182. data: {},
  183. show: false,
  184. rules: {
  185. phone: {
  186. rules: [{
  187. required: true,
  188. errorMessage: '请输入联系电话'
  189. }, ]
  190. },
  191. detailregion: {
  192. rules: [{
  193. required: true,
  194. errorMessage: '请输入详细地址'
  195. }, ]
  196. },
  197. name: {
  198. rules: [{
  199. required: true,
  200. errorMessage: '请输入收件人'
  201. }, ]
  202. },
  203. tel: {
  204. rules: [{
  205. required: true,
  206. errorMessage: '请输入联系电话',
  207. }, ]
  208. },
  209. fregion: {
  210. rules: [{
  211. required: true,
  212. errorMessage: '请选择所在地区'
  213. }, ]
  214. },
  215. nickname: {
  216. rules: [{
  217. required: true,
  218. errorMessage: '请输入昵称'
  219. }, ]
  220. },
  221. numberfans: {
  222. rules: [{
  223. required: true,
  224. errorMessage: '请输入粉丝数'
  225. }, ]
  226. },
  227. home_link: {
  228. rules: [{
  229. required: true,
  230. errorMessage: '请输入主页链接'
  231. }, ]
  232. },
  233. home_img: {
  234. rules: [{
  235. required: true,
  236. errorMessage: '请选择主页截图'
  237. }, ]
  238. },
  239. },
  240. mysNavConfig: {
  241. /* 开启单页显示首页图标 */
  242. isHome: true,
  243. /* 固定导航 */
  244. navFixed: true,
  245. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  246. navTitle: {
  247. text: "我的信息",
  248. color: "",
  249. fontSize: "32rpx", // px upx rpx
  250. fontWeight: "normal", // 100 - 700
  251. },
  252. btnType: "type2",
  253. onLeftClick: '',
  254. /* type2 按钮 */
  255. type2Config: {
  256. // 左图标
  257. leftPath: "/static/img/png2.png",
  258. // 右图标
  259. rightPath: "/static/img/png4.png",
  260. // 圆角
  261. radius: "40rpx",
  262. },
  263. },
  264. }
  265. },
  266. onReady() {
  267. this.$refs.form.setRules(this.rules)
  268. },
  269. onShow() {
  270. this.getDefaultAddress()
  271. this.getlist()
  272. },
  273. onLoad(options) {
  274. this.platform.platform_id = parseInt(options.platform_id)
  275. if (options.account_id) {
  276. this.accountId = parseInt(options.account_id)
  277. this.isBind = false
  278. }
  279. },
  280. methods: {
  281. // 信息表
  282. getlist() {
  283. this.$https.get('/youngee/c/g/get-info-tables')
  284. .then(res => {
  285. console.log(res)
  286. this.array = res.data.data.AgeBracket
  287. let list = res.data.data.ThirdPlatform
  288. for (var i = 0; i < list.length; ++i) {
  289. if (list[i].id == this.platform.platform_id) {
  290. this.platform.platform_icon = list[i].platform_icon
  291. this.platform.platform_name = list[i].platform_name
  292. }
  293. }
  294. this.getlist1()
  295. this.getaccount()
  296. })
  297. },
  298. // 达人详细信息表
  299. getlist1() {
  300. this.$https.get('/youngee/c/t/g/get-talent-info')
  301. .then(res => {
  302. console.log(res)
  303. if (res.data.data.talent_wx_number !== null) {
  304. if (res.data.data.talent_age_bracket !== 0) {
  305. for (var i = 0; i < this.array.length; i++) {
  306. if (this.array[i].age_aid == res.data.data.talent_age_bracket) {
  307. this.Xage = this.array[i].age_bracket_discribe
  308. }
  309. this.formData.age = res.data.data.talent_age_bracket
  310. }
  311. }
  312. if (res.data.data.talent_nationality !== 0) {
  313. this.index1 = res.data.data.talent_nationality
  314. this.formData.nationality = res.data.data.talent_nationality
  315. }
  316. if (res.data.data.visit_store_region !== 0) {
  317. let a = res.data.data.visit_store_region.toString().slice(0, 2)
  318. let b = res.data.data.visit_store_region.toString().slice(0, 4)
  319. let c = 0
  320. for (var i = 0; i < region.length; i++) {
  321. if (region[i].code == a) {
  322. a = region[i].name
  323. for (var j = 0; j < region[i].children.length; j++) {
  324. if (region[i].children[j].code == b) {
  325. b = region[i].children[j].name
  326. for (var o = 0; o < region[i].children[j].children
  327. .length; o++) {
  328. if (region[i].children[j].children[o].code == res.data.data
  329. .visit_store_region) {
  330. c = region[i].children[j].children[o].name
  331. }
  332. }
  333. }
  334. }
  335. }
  336. }
  337. this.regionStr = a + ' ' + b + ' ' + c
  338. this.formData.visitStoreRegion = res.data.data.visit_store_region
  339. }
  340. this.formData.phone = res.data.data.talent_phone_number
  341. }
  342. })
  343. },
  344. getaccount() {
  345. console.log(this.isBind)
  346. if (!this.isBind) {
  347. this.$https.get('/youngee/c/t/g/get-talent-account')
  348. .then(res => {
  349. console.log(res)
  350. if (res.data.code !== -3) {
  351. this.account = res.data.data
  352. for (var i = 0; i < this.account.length; i++) {
  353. if (this.platform.platform_id == this.account[i].platform_id) {
  354. this.formData.platform_nickname = this.account[i].platform_nickname
  355. this.formData.fans_count = this.account[i].fans_count
  356. this.formData.home_page_url = this.account[i].home_page_url
  357. this.imageData.push(this.account[i].home_page_capture_url);
  358. }
  359. }
  360. }
  361. })
  362. }
  363. },
  364. setDefault(e) {
  365. console.log(e.detail.value)
  366. if (e.detail.value)
  367. this.formData.setdefault = 1
  368. else
  369. this.formData.setdefault = 0
  370. },
  371. getDefaultAddress() {
  372. this.$https.get('/youngee/c/t/g/get-talent-default-address').then(res => {
  373. this.formData.name = res.data.data.receiver_name
  374. this.formData.tel = res.data.data.phone_number
  375. this.formData.detailregion = res.data.data.detail_addr
  376. this.formData.fregion = res.data.data.region_code
  377. console.log("111")
  378. console.log(this.formData)
  379. let a = res.data.data.region_code.toString().slice(0, 2)
  380. let b = res.data.data.region_code.toString().slice(0, 4)
  381. let c = 0
  382. for (var i = 0; i < region.length; i++) {
  383. if (region[i].code == a) {
  384. a = region[i].name
  385. for (var j = 0; j < region[i].children.length; j++) {
  386. if (region[i].children[j].code == b) {
  387. b = region[i].children[j].name
  388. for (var o = 0; o < region[i].children[j].children.length; o++) {
  389. if (region[i].children[j].children[o].code == res.data.data.region_code) {
  390. c = region[i].children[j].children[o].name
  391. }
  392. }
  393. }
  394. }
  395. }
  396. }
  397. this.regionStr1 = a + ' ' + b + ' ' + c
  398. })
  399. },
  400. /**
  401. * 手动提交
  402. * @param {Object} form
  403. */
  404. submitForm(form) {
  405. // console.log(this.formData);
  406. this.$refs.form.validate().then(res => {
  407. const iphoneReg1 = /^1[0-9]{10}$/
  408. const urlReg =
  409. /(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%$#_]*)?/
  410. if (!iphoneReg1.test(this.formData.phone)) {
  411. uni.showToast({
  412. title: '电话号码格式不正确',
  413. icon: 'none'
  414. })
  415. return
  416. }
  417. if (!urlReg.test(this.formData.home_page_url)) {
  418. uni.showToast({
  419. title: '主页链接格式不正确',
  420. icon: 'none'
  421. })
  422. return
  423. }
  424. uni.showToast({
  425. title: '提交成功'
  426. })
  427. this.$https.post('/youngee/c/t/p/talent-info', {
  428. talent_age_bracket: this.formData.age,
  429. talent_nationality: this.formData.nationality,
  430. visit_store_region: this.formData.visitStoreRegion,
  431. talent_phone_number: this.formData.phone,
  432. })
  433. .then(res => {
  434. console.log(res)
  435. })
  436. this.$https.post('/youngee/c/t/p/add-talent-address', {
  437. region_code: this.formData.fregion,
  438. detail_addr: this.formData.detailregion,
  439. phone_number: this.formData.phone,
  440. receiver_name: this.formData.name,
  441. default_tag: this.formData.setdefault
  442. })
  443. .then(res => {
  444. console.log(res)
  445. })
  446. this.formData.home_page_capture_url = this.imageData[0]
  447. if (this.isBind) {
  448. this.$https.post('/youngee/c/t/p/add-talent-account', {
  449. platform_id: this.platform.platform_id,
  450. platform_nickname: this.formData.platform_nickname,
  451. home_page_url: this.formData.home_page_url,
  452. fans_count: this.formData.fans_count,
  453. home_page_capture_url: this.formData
  454. .home_page_capture_url,
  455. })
  456. .then(res => {
  457. console.log(res)
  458. })
  459. } else {
  460. this.$https.post('/youngee/c/t/p/update-talent-account', {
  461. account_id: this.accountId,
  462. platform_id: this.platform.platform_id,
  463. platform_nickname: this.formData.platform_nickname,
  464. home_page_url: this.formData.home_page_url,
  465. fans_count: this.formData.fans_count,
  466. home_page_capture_url: this.formData
  467. .home_page_capture_url,
  468. })
  469. .then(res => {
  470. console.log(res)
  471. })
  472. }
  473. uni.showToast({
  474. title: '修改成功'
  475. })
  476. uni.navigateBack()
  477. }).catch(err => {
  478. console.error('验证失败:', errors)
  479. uni.showToast({
  480. title: '请填写所有信息',
  481. icon: 'none'
  482. })
  483. })
  484. },
  485. ceshiChooseSuccess(tempFilePaths, e) { //选择图片返回
  486. console.log('ceshiChooseSuccess', tempFilePaths, e);
  487. if (e == 0) {
  488. this.store = 'talent_upload/' + this.guid() + '.png'
  489. } else if (e == 1) {
  490. this.store = 'talent_upload/' + this.guid() + '.mp4'
  491. }
  492. /****************
  493. 以下代码是自定义上传逻辑,仅供参考
  494. ***************/
  495. this.imgUpload(tempFilePaths);
  496. /*******************************/
  497. console.log("imgdata" + this.imageData)
  498. },
  499. imgUpload(tempFilePaths) {
  500. let that = this
  501. console.log('imgUpload', tempFilePaths)
  502. let config = {
  503. AccessKeyId: 'IVW21DTGIIUBBAGXKK0Y', //AK
  504. SecretKey: 'Y01nEQNcLOATMw7uJwrk3yOdQZ2fqLhSnXcOKVDE', //SK
  505. EndPoint: 'https://horastar.obs.cn-east-3.myhuaweicloud.com', //上传文件的路径
  506. };
  507. let fileName = this.store; //指定上传到OBS桶中的对象名
  508. // let fileName = "talent_upload/icon-arrow-right.png"
  509. let OBSPolicy = { //设定policy内容
  510. "expiration": "2089-12-31T12:00:00.000Z",
  511. "conditions": [{
  512. "bucket": "horastar"
  513. }, //Bucket name
  514. // {"bucket": "goin"},
  515. {
  516. 'key': fileName
  517. }
  518. ]
  519. }
  520. let policyEncoded = getPolicyEncode(OBSPolicy); //计算policy编码值
  521. let signature = getSignature(policyEncoded, config.SecretKey); //计算signature
  522. uni.uploadFile({
  523. //url: config.EndPoint,
  524. url: config.EndPoint,
  525. filePath: tempFilePaths[0],
  526. name: 'file',
  527. formData: {
  528. 'AccessKeyID': config.AccessKeyId,
  529. 'policy': policyEncoded,
  530. 'signature': signature,
  531. 'key': fileName,
  532. },
  533. success: function(res) {
  534. console.log(res.statusCode); //打印响应状态码
  535. if (res.statusCode == '204') {
  536. that.imageData.push(config.EndPoint + '/' + fileName);
  537. console.log('上传图片成功', res)
  538. let obs_url = config.EndPoint + '/' + fileName; //用你自己的 bucket 名替换星号
  539. console.log(obs_url)
  540. that.formData.home_img = obs_url
  541. uni.showToast({
  542. title: '上传成功',
  543. icon: '成功'
  544. });
  545. } else {
  546. console.log('上传图片失败', res)
  547. uni.showToast({
  548. title: '上传失败',
  549. icon: '失败'
  550. });
  551. }
  552. },
  553. fail: function(e) {
  554. console.log(e);
  555. }
  556. })
  557. },
  558. guid() {
  559. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
  560. var r = Math.random() * 16 | 0,
  561. v = c == 'x' ? r : (r & 0x3 | 0x8);
  562. return v.toString(16);
  563. });
  564. },
  565. // 年龄选择的
  566. bindPickerChange: function(e) {
  567. this.index = e.detail.value;
  568. this.formData.age = this.array[this.index].age_aid
  569. this.Xage = this.array[this.index].age_bracket_discribe
  570. console.log(this.formData.age)
  571. },
  572. //国籍选择
  573. bindPickerChange1: function(e) {
  574. console.log(e)
  575. this.index1 = e.detail.value;
  576. this.formData.nationality = this.array1[this.index1].id
  577. console.log(this.formData.nationality)
  578. },
  579. //城市选择
  580. pickerChange(e) {
  581. // console.log(e, '1');
  582. this.regionIndex = e.detail.value;
  583. this.regionStr = this.region[0][this.regionIndex[0]].name + ' ' + this.region[1][this.regionIndex[
  584. 1]]
  585. .name + ' ' +
  586. this.region[2][this.regionIndex[2]].name;
  587. // 组件传值
  588. this.$emit('region', [this.region[0][this.regionIndex[0]].code, this.region[1][this.regionIndex[1]]
  589. .code,
  590. this.region[
  591. 2][this.regionIndex[2]].code
  592. ]);
  593. this.formData.visitStoreRegion = this.region[2][this.regionIndex[2]].code;
  594. },
  595. pickerColumnchange(e) {
  596. // console.log(e);
  597. // 第几列滑动
  598. // console.log(e.detail.column);
  599. // 第几列滑动的下标
  600. // console.log(e.detail.value)
  601. if (e.detail.column === 0) {
  602. // 声明城市数组
  603. let cityArr = [];
  604. let countyArr = [];
  605. // 设置下标
  606. this.regionIndex = [e.detail.value, 0, 0];
  607. // 改变城市列表
  608. this.region[1] = this.oldRegion[e.detail.value].children.map(item => {
  609. cityArr.push({
  610. name: item.name,
  611. code: item.code
  612. });
  613. })
  614. this.$set(this.region, 1, cityArr);
  615. // 改变县区列表
  616. this.oldRegion[e.detail.value].children[0].children.map(item => {
  617. countyArr.push({
  618. name: item.name,
  619. code: item.code
  620. });
  621. })
  622. this.$set(this.region, 2, countyArr);
  623. }
  624. if (e.detail.column === 1) {
  625. this.regionIndex[1] = e.detail.value;
  626. this.regionIndex[2] = 0;
  627. let countyArr = [];
  628. this.oldRegion[this.regionIndex[0]].children[this.regionIndex[1]].children.map(item => {
  629. countyArr.push({
  630. name: item.name,
  631. code: item.code
  632. });
  633. })
  634. this.$set(this.region, 2, countyArr);
  635. }
  636. if (e.detail.column === 2) {
  637. this.regionIndex[2] = e.detail.value;
  638. }
  639. },
  640. //城市选择
  641. pickerChange(e) {
  642. // console.log(e, '1');
  643. this.regionIndex = e.detail.value;
  644. this.regionStr = this.region[0][this.regionIndex[0]].name + ' ' + this.region[1][this.regionIndex[
  645. 1]]
  646. .name + ' ' +
  647. this.region[2][this.regionIndex[2]].name;
  648. // 组件传值
  649. this.$emit('region', [this.region[0][this.regionIndex[0]].code, this.region[1][this.regionIndex[1]]
  650. .code,
  651. this.region[
  652. 2][this.regionIndex[2]].code
  653. ]);
  654. this.formData.visitStoreRegion = this.region[2][this.regionIndex[2]].code;
  655. },
  656. pickerColumnchange(e) {
  657. // console.log(e);
  658. // 第几列滑动
  659. // console.log(e.detail.column);
  660. // 第几列滑动的下标
  661. // console.log(e.detail.value)
  662. if (e.detail.column === 0) {
  663. // 声明城市数组
  664. let cityArr = [];
  665. let countyArr = [];
  666. // 设置下标
  667. this.regionIndex = [e.detail.value, 0, 0];
  668. // 改变城市列表
  669. this.region[1] = this.oldRegion[e.detail.value].children.map(item => {
  670. cityArr.push({
  671. name: item.name,
  672. code: item.code
  673. });
  674. })
  675. this.$set(this.region, 1, cityArr);
  676. // 改变县区列表
  677. this.oldRegion[e.detail.value].children[0].children.map(item => {
  678. countyArr.push({
  679. name: item.name,
  680. code: item.code
  681. });
  682. })
  683. this.$set(this.region, 2, countyArr);
  684. }
  685. if (e.detail.column === 1) {
  686. this.regionIndex[1] = e.detail.value;
  687. this.regionIndex[2] = 0;
  688. let countyArr = [];
  689. this.oldRegion[this.regionIndex[0]].children[this.regionIndex[1]].children.map(item => {
  690. countyArr.push({
  691. name: item.name,
  692. code: item.code
  693. });
  694. })
  695. this.$set(this.region, 2, countyArr);
  696. }
  697. if (e.detail.column === 2) {
  698. this.regionIndex[2] = e.detail.value;
  699. }
  700. },
  701. //城市选择
  702. pickerChange1(e) {
  703. // console.log(e, '1');
  704. this.regionIndex1 = e.detail.value;
  705. this.regionStr1 = this.region[0][this.regionIndex1[0]].name + ' ' + this.region[1][this.regionIndex1[
  706. 1]]
  707. .name + ' ' +
  708. this.region[2][this.regionIndex1[2]].name;
  709. // 组件传值
  710. this.$emit('region', [this.region[0][this.regionIndex1[0]].code, this.region[1][this.regionIndex1[1]]
  711. .code,
  712. this.region[
  713. 2][this.regionIndex1[2]].code
  714. ]);
  715. this.formData.fregion = this.region[2][this.regionIndex1[2]].code;
  716. console.log(this.formData.fregion)
  717. },
  718. pickerColumnchange1(e) {
  719. if (e.detail.column === 0) {
  720. // 声明城市数组
  721. let cityArr = [];
  722. let countyArr = [];
  723. // 设置下标
  724. this.regionIndex1 = [e.detail.value, 0, 0];
  725. // 改变城市列表
  726. this.region[1] = this.oldRegion[e.detail.value].children.map(item => {
  727. cityArr.push({
  728. name: item.name,
  729. code: item.code
  730. });
  731. })
  732. this.$set(this.region, 1, cityArr);
  733. // 改变县区列表
  734. this.oldRegion[e.detail.value].children[0].children.map(item => {
  735. countyArr.push({
  736. name: item.name,
  737. code: item.code
  738. });
  739. })
  740. this.$set(this.region, 2, countyArr);
  741. }
  742. if (e.detail.column === 1) {
  743. this.regionIndex1[1] = e.detail.value;
  744. this.regionIndex1[2] = 0;
  745. let countyArr = [];
  746. this.oldRegion[this.regionIndex1[0]].children[this.regionIndex1[1]].children.map(item => {
  747. countyArr.push({
  748. name: item.name,
  749. code: item.code
  750. });
  751. })
  752. this.$set(this.region, 2, countyArr);
  753. }
  754. if (e.detail.column === 2) {
  755. this.regionIndex1[2] = e.detail.value;
  756. }
  757. },
  758. },
  759. created() {
  760. let provinceArr = [];
  761. let cityArr = [];
  762. this.oldRegion.map((item, index) => {
  763. this.region[0].push({
  764. name: item.name,
  765. code: item.code
  766. });
  767. })
  768. // console.log(provinceArr);
  769. provinceArr.map((item, index) => {
  770. this.region[1].push({
  771. name: item.name,
  772. code: item.code
  773. });
  774. })
  775. cityArr.map((item, index) => {
  776. this.region[2].push({
  777. name: item.name,
  778. code: item.code
  779. });
  780. })
  781. this.regionStr = '请选择省市区';
  782. }
  783. };
  784. </script>
  785. <style>
  786. picker {
  787. position: relative;
  788. display: block;
  789. cursor: pointer;
  790. padding-left: 20rpx !important;
  791. padding-top: 20rpx !important;
  792. color: grey !important;
  793. }
  794. /deep/.uni-forms-item__inner {
  795. border-bottom: none !important;
  796. margin-bottom: 0 !important;
  797. }
  798. </style>
  799. <style lang="scss" scoped>
  800. @charset "UTF-8";
  801. /* 头条小程序组件内不能引入字体 */
  802. /* #ifdef MP-TOUTIAO */
  803. @font-face {
  804. font-family: uniicons;
  805. font-weight: normal;
  806. font-style: normal;
  807. src: url("~@/static/uni.ttf") format("truetype");
  808. }
  809. /* #endif */
  810. /* #ifndef APP-NVUE */
  811. page {
  812. display: flex;
  813. flex-direction: column;
  814. box-sizing: border-box;
  815. background-color: #FFFFFF;
  816. min-height: 100%;
  817. height: auto;
  818. }
  819. view {
  820. font-size: 14px;
  821. // line-height: inherit;
  822. }
  823. .line {
  824. width: 96%;
  825. margin: 10rpx 2%;
  826. border-bottom: 1rpx solid #bbbbbb;
  827. }
  828. .title {
  829. height: 80rpx;
  830. display: flex;
  831. align-items: center;
  832. }
  833. .menu {
  834. position: fixed;
  835. top: 180rpx;
  836. background-color: #FFFFFF;
  837. justify-content: space-around;
  838. height: 80rpx;
  839. // height: 5%;
  840. width: 100%;
  841. display: flex;
  842. z-index: 10;
  843. margin-bottom: 10rpx;
  844. }
  845. .menu-item p {
  846. font-weight: 600;
  847. &.lor {
  848. border-bottom: 5rpx solid #F0D232;
  849. color: #F0D232;
  850. padding-bottom: 15rpx;
  851. }
  852. }
  853. .setdeault {
  854. display: flex;
  855. justify-content: space-between;
  856. }
  857. .btn1 {
  858. width: 100%;
  859. margin-top: 30rpx;
  860. font-size: 35rpx;
  861. color: #FFFFFF;
  862. background-color: #F0D232;
  863. border: none;
  864. border-radius: 0;
  865. }
  866. .uni-input-border,
  867. .uni-textarea-border {
  868. flex: 1;
  869. font-size: 14px;
  870. color: #666;
  871. border: 1px #FFFFFF solid;
  872. border-radius: 5px;
  873. /* #ifndef APP-NVUE */
  874. box-sizing: border-box;
  875. /* #endif */
  876. }
  877. .uni-input-border {
  878. padding: 0 10px;
  879. height: 35px;
  880. }
  881. .uni-textarea-border {
  882. padding: 10px;
  883. height: 80px;
  884. }
  885. .label-box {
  886. margin-right: 10px;
  887. }
  888. .transform-scale {
  889. transform: scale(0.7);
  890. }
  891. .butto {
  892. text-align: center;
  893. }
  894. .option {
  895. padding: 20rpx;
  896. }
  897. .uni-margin-wrap {
  898. width: 690rpx;
  899. width: 100%;
  900. ;
  901. }
  902. .swiper {
  903. height: 300rpx;
  904. }
  905. .swiper-item {
  906. display: block;
  907. height: 300rpx;
  908. line-height: 300rpx;
  909. text-align: center;
  910. }
  911. .swiper-list {
  912. margin-top: 40rpx;
  913. margin-bottom: 0;
  914. }
  915. .uni-common-mt {
  916. margin-top: 60rpx;
  917. position: relative;
  918. }
  919. .info {
  920. position: absolute;
  921. right: 20rpx;
  922. }
  923. .uni-padding-wrap {
  924. width: 550rpx;
  925. padding: 0 100rpx;
  926. }
  927. .signup {
  928. box-shadow: 0rpx 5rpx 40rpx #ccc;
  929. width: 100%;
  930. position: fixed;
  931. bottom: 0rpx;
  932. display: flex;
  933. height: 90rpx;
  934. padding-top: 2%;
  935. background-color: #FFFFFF;
  936. justify-content: space-around;
  937. }
  938. .signuptext {
  939. text-align: center;
  940. margin-top: 2%;
  941. }
  942. .signuptext p {
  943. font-size: 60%;
  944. color: #333333;
  945. }
  946. .signupbut {
  947. text-align: center;
  948. margin-top: 2%;
  949. }
  950. .but1 {
  951. width: 120%;
  952. text-align: center;
  953. background-color: #FCCF41;
  954. border-radius: 10rpx;
  955. color: #464100;
  956. font-size: 28rpx;
  957. line-height: 156%;
  958. font-weight: 500;
  959. height: 65%;
  960. }
  961. /deep/.uni-searchbar__box {
  962. border-color: #267CFF !important;
  963. border-width: 2rpx !important;
  964. }
  965. /deep/.uni-searchbar__box {
  966. background-color: #FFFFFF !important;
  967. }
  968. /deep/.uni-searchbar__text-placeholder {
  969. font-size: 30rpx !important;
  970. }
  971. /deep/.segmented-control__text {
  972. font-size: 34rpx !important;
  973. }
  974. /deep/.uni-data-checklist {
  975. padding-left: 20upx;
  976. }
  977. uni-picker {
  978. position: relative;
  979. display: block;
  980. cursor: pointer;
  981. padding-left: 20rpx !important;
  982. padding-top: 14rpx !important;
  983. color: grey !important;
  984. }
  985. /deep/.uni-date-x--border {
  986. border: 0px solid #dcdfe6 !important;
  987. }
  988. /deep/.is-input-border {
  989. border: 0px solid #c8c7cc !important;
  990. }
  991. /deep/.uni-progress-info {
  992. font-size: 25rpx !important;
  993. }
  994. /deep/.uni-error-message {
  995. position: absolute;
  996. bottom: -20rpx !important;
  997. left: 20rpx !important;
  998. text-align: left;
  999. }
  1000. /deep/.uni-forms-item__inner {
  1001. padding-bottom: 0rpx !important;
  1002. margin-bottom: 30rpx !important;
  1003. border-bottom: 0.5rpx solid #CCCCCC;
  1004. }
  1005. /deep/.uni-group__title {
  1006. background-color: #FFFFFF !important;
  1007. }
  1008. /deep/.uni-list-item__content-title {
  1009. font-size: 30rpx !important;
  1010. color: #111111 !important;
  1011. }
  1012. /deep/.uni-progress-bar {
  1013. border-radius: 10rpx !important;
  1014. }
  1015. /deep/.uni-progress-inner-bar {
  1016. border-radius: 10rpx !important;
  1017. }
  1018. /deep/.is-input-border {
  1019. border-radius: 20px !important;
  1020. background-color: #fff;
  1021. }
  1022. .uni-easyinput__content-input {
  1023. font-size: 30upx !important;
  1024. }
  1025. .content-clear-icon {
  1026. font-size: 40upx !important;
  1027. }
  1028. /deep/.input-box {
  1029. padding: 50upx;
  1030. font-size: 30upx;
  1031. .input-item {
  1032. display: flex;
  1033. border: 1upx solid #F8F8F8;
  1034. line-height: 90upx;
  1035. height: 90upx;
  1036. margin-top: 20upx;
  1037. background: #F8F8F8;
  1038. border-radius: 48upx;
  1039. .input-label {
  1040. width: 150upx;
  1041. text-align: center;
  1042. }
  1043. .input-body {
  1044. position: relative;
  1045. height: 100upx;
  1046. width: calc(100% - 150upx);
  1047. .input {
  1048. line-height: 90upx;
  1049. height: 90upx;
  1050. position: relative;
  1051. font-size: 28upx;
  1052. }
  1053. .eye {
  1054. position: absolute;
  1055. height: 50upx;
  1056. width: 50upx;
  1057. right: 20upx;
  1058. top: 50%;
  1059. transform: translateY(-50%);
  1060. }
  1061. .btn-code {
  1062. position: absolute;
  1063. right: 0upx;
  1064. top: 50%;
  1065. transform: translateY(-50%);
  1066. background: none;
  1067. color: #205592;
  1068. width: 160upx;
  1069. font-size: 24upx;
  1070. box-sizing: border-box;
  1071. text-align: center;
  1072. padding: 0;
  1073. height: 100upx;
  1074. line-height: 100upx;
  1075. }
  1076. }
  1077. }
  1078. .select {
  1079. // padding-top: 40upx;
  1080. display: flex;
  1081. justify-content: space-between;
  1082. color: #003B67;
  1083. }
  1084. }
  1085. /deep/.title-left {
  1086. width: 3px;
  1087. height: 16px;
  1088. background: #267CFF;
  1089. display: inline-block;
  1090. border-radius: 3px;
  1091. margin-top: 3px;
  1092. vertical-align: top;
  1093. margin-right: 10px;
  1094. }
  1095. .card {
  1096. padding: 24rpx;
  1097. margin-top: 30rpx;
  1098. border: 1rpx solid #F0D232;
  1099. background-color: #ffffff;
  1100. margin: 0 10rpx;
  1101. }
  1102. .head {
  1103. padding-top: 5%;
  1104. padding: 0 0 0 1%;
  1105. height: 80rpx;
  1106. margin-top: 2%;
  1107. }
  1108. .head span {
  1109. color: #333333;
  1110. font-size: 80%;
  1111. font-weight: 550;
  1112. text-indent: 2em;
  1113. }
  1114. .head image {
  1115. vertical-align: middle;
  1116. width: 50rpx;
  1117. height: 50rpx;
  1118. display: inline-block;
  1119. padding-right: 14rpx;
  1120. }
  1121. .home-link {
  1122. /deep/.uni-easyinput__content-input {
  1123. background-color: #EBEBEB;
  1124. border-radius: 15rpx;
  1125. }
  1126. }
  1127. .heng-line {
  1128. margin-top: 60rpx;
  1129. margin-bottom: 50rpx;
  1130. border: 1rpx solid #DCDCDC;
  1131. }
  1132. .signupbtn p {
  1133. font-size: 30rpx;
  1134. }
  1135. .exit-btn {
  1136. width: 120%;
  1137. text-align: center;
  1138. background-color: #C0C0C0;
  1139. border-radius: 10rpx;
  1140. color: #FFFFFF;
  1141. font-size: 30rpx;
  1142. line-height: 180%;
  1143. }
  1144. .main-btn {
  1145. width: 300rpx;
  1146. text-align: center;
  1147. background-color: #FCCF41;
  1148. border-radius: 10rpx;
  1149. color: #000000;
  1150. font-size: 30rpx;
  1151. line-height: 180%;
  1152. }
  1153. .uni-input-placeholder {
  1154. font-size: 24rpx !important;
  1155. }
  1156. /deep/.uni-date-x--border {
  1157. border: 0px solid #dcdfe6 !important;
  1158. }
  1159. /deep/.is-input-border {
  1160. border: 0px solid #c8c7cc !important;
  1161. }
  1162. .example {
  1163. padding: 0 15px 15px;
  1164. }
  1165. .example-info {
  1166. padding: 15px;
  1167. color: #3b4144;
  1168. background: #ffffff;
  1169. }
  1170. .example-body {
  1171. /* #ifndef APP-NVUE */
  1172. display: flex;
  1173. /* #endif */
  1174. flex-direction: row;
  1175. flex-wrap: wrap;
  1176. justify-content: center;
  1177. padding: 0;
  1178. font-size: 14px;
  1179. background-color: #ffffff;
  1180. }
  1181. /* #endif */
  1182. .example {
  1183. padding: 0 15px;
  1184. }
  1185. .example-info {
  1186. /* #ifndef APP-NVUE */
  1187. display: block;
  1188. /* #endif */
  1189. padding: 15px;
  1190. color: #3b4144;
  1191. background-color: #ffffff;
  1192. font-size: 14px;
  1193. line-height: 20px;
  1194. }
  1195. .example-info-text {
  1196. font-size: 14px;
  1197. line-height: 20px;
  1198. color: #3b4144;
  1199. }
  1200. .example-body {
  1201. flex-direction: column;
  1202. padding: 15px;
  1203. background-color: #ffffff;
  1204. }
  1205. </style>