Step2.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <member-base :show="false"><view class="div">
  3. <view class="div common-header-wrap">
  4. <view :style="'height:'+navHeight+'px'"></view>
  5. <view class="common-header-holder"></view>
  6. <view class="common-header-fixed">
  7. <title-header />
  8. <uni-nav-bar title="店铺入驻" class="common-header" left-icon="back" @clickLeft="goBack()">
  9. </uni-nav-bar>
  10. </view>
  11. </view>
  12. <step :options="options" :active="0"></step>
  13. <view class="div label">店铺及联系人信息</view>
  14. <view class="div main-content">
  15. <flex-line class="field-line" :show-border="true"><text class="span field-name">{{storeJoinin.store_type==1?'店铺名称':'公司名称'}}</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="storeJoinin.company_name" /></view></flex-line>
  16. <view class="div" @click="onRegion('company_address')"><flex-line :is-link="true" :show-border="true"><text class="span line-name">所在地</text><text class="span" slot="right">{{storeJoinin.company_address}}</text></flex-line></view>
  17. <view v-if="!storeJoinin.company_address_detail" class="div" @click="showPopup('popMap')"><flex-line :is-link="true" :show-border="true"><text class="span line-name">详细地址</text><text class="span" slot="right">{{storeJoinin.company_address_detail}}</text></flex-line></view>
  18. <flex-line v-else class="field-line" :show-border="true"><text class="field-name">详细地址</text><view class="field-line-right" slot="right"><input class="field-input" v-model="storeJoinin.company_address_detail" /></view></flex-line>
  19. <flex-line v-if="storeJoinin.store_type==0" class="field-line" :show-border="true"><text class="span field-name">注册资金(万元)</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="storeJoinin.company_registered_capital" /></view></flex-line>
  20. <flex-line v-if="storeJoinin.store_type==0" class="field-line" :show-border="true"><text class="span field-name">联系人姓名</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="storeJoinin.contacts_name" /></view></flex-line>
  21. <flex-line class="field-line" :show-border="true"><text class="span field-name">联系人电话</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="storeJoinin.contacts_phone" /></view></flex-line>
  22. <flex-line class="field-line" :show-border="true"><text class="span field-name">电子邮箱</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="storeJoinin.contacts_email" /></view></flex-line>
  23. </view>
  24. <view class="div label">{{storeJoinin.store_type==0?'营业执照信息(副本)':'证件信息'}}</view>
  25. <view class="div main-content">
  26. <flex-line class="field-line" v-if="storeJoinin.store_type==1" :show-border="true"><text class="span field-name">持证人姓名</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="storeJoinin.contacts_name" /></view></flex-line>
  27. <flex-line class="field-line" :show-border="true"><text class="span field-name">{{storeJoinin.store_type==0?'营业执照号':'证件号码'}}</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="storeJoinin.business_licence_number" /></view></flex-line>
  28. <view class="div" v-if="storeJoinin.store_type==0" @click="onRegion('business_licence_address')"><flex-line :is-link="true" :show-border="true"><text class="span line-name">营业执照所在地</text><text class="span" slot="right">{{storeJoinin.business_licence_address}}</text></flex-line></view>
  29. <view class="div" v-if="storeJoinin.store_type==0">
  30. <flex-line :is-link="true" :show-border="true">
  31. <text class="span line-name">有效期起始</text>
  32. <view class="span" slot="right">
  33. <uni-datetime-picker class="common-datetime-picker" type="date" v-model="storeJoinin.business_licence_start"
  34. start="2000/1/1"></uni-datetime-picker>
  35. </view>
  36. </flex-line>
  37. </view>
  38. <view class="div" v-if="storeJoinin.store_type==0">
  39. <flex-line :is-link="true" :show-border="true">
  40. <text class="span line-name">有效期结束</text>
  41. <view class="span" slot="right">
  42. <uni-datetime-picker class="common-datetime-picker" type="date" v-model="storeJoinin.business_licence_end"
  43. start="2000/1/1"></uni-datetime-picker>
  44. </view>
  45. </flex-line>
  46. </view>
  47. <flex-line v-if="storeJoinin.store_type==0" class="field-line" :show-border="true"><text class="span field-name">经营范围</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="storeJoinin.business_sphere" /></view></flex-line>
  48. <flex-line class="pt-5" :show-border="true">
  49. <text class="span">{{storeJoinin.store_type==0?'营业执照电子版':'身份证正面'}}</text>
  50. <view class="div" slot="right">
  51. <view class="div user-avatar-wrapper">
  52. <view class="div user-avatar">
  53. <uni-file-picker
  54. class="common-avatar"
  55. v-model="business_licence_number_electronic_lsit"
  56. fileMediatype="image"
  57. mode="grid"
  58. :limit="1"
  59. :auto-upload="false"
  60. @select="uploadSelectImg('business_licence_number_electronic', $event)"
  61. @delete="dropImage('business_licence_number_electronic')"
  62. :image-styles="{
  63. width:'200px',
  64. height:'160px',
  65. }"></uni-file-picker>
  66. </view>
  67. </view>
  68. </view>
  69. </flex-line>
  70. <flex-line class="pt-5" :show-border="true">
  71. <div>
  72. <text class="span">{{storeJoinin.store_type==0?'企业授权书':'身份证反面'}}</text>
  73. <div class="button look-button" v-if="storeJoinin.store_type==0" v-on:click="lookImage()">查看实例</div>
  74. </div>
  75. <view class="div" slot="right">
  76. <view class="div user-avatar-wrapper">
  77. <view class="div user-avatar">
  78. <uni-file-picker
  79. class="common-avatar"
  80. v-model="business_author_letter_list"
  81. fileMediatype="image"
  82. mode="grid"
  83. :limit="1"
  84. :auto-upload="false"
  85. @select="uploadSelectImg('business_author_letter', $event)"
  86. @delete="dropImage('business_author_letter')"
  87. :image-styles="{
  88. width:'200px',
  89. height:'160px',
  90. }">
  91. </uni-file-picker>
  92. </view>
  93. </view>
  94. </view>
  95. </flex-line>
  96. </view>
  97. <view class="div common-btn ds-button-large mt-10" @click="nextStep">下一步</view>
  98. <view class="div">
  99. <uni-popup background-color="#fff" ref="isshow" class="popup" >
  100. <!-- <div>{{showimage}}</div> -->
  101. <image mode="aspectFit" class="img" :src="showimage" :style="getBannerStyle" @click="hidePopup('isshow')">
  102. </uni-popup>
  103. </view>
  104. <view class="div">
  105. <region-picker ref="picker" @onConfirm="onPickerConfirm"></region-picker>
  106. </view>
  107. <view class="div">
  108. <uni-popup background-color="#fff" ref="popMap" type="right" >
  109. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  110. <view class="div common-header-wrap">
  111. <view :style="'height:'+navHeight+'px'"></view>
  112. <view class="common-header-holder"></view>
  113. <view class="common-header-fixed">
  114. <title-header />
  115. <uni-nav-bar title="定位" class="common-header" left-icon="back" @clickLeft="hidePopup('popMap')">
  116. </uni-nav-bar>
  117. </view>
  118. </view>
  119. <view class="div common-popup-content">
  120. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" scroll-y="true">
  121. <map-select ref="map_select" :longitude="storeJoinin.store_longitude" :latitude="storeJoinin.store_latitude" @setPosition="setPosition"></map-select>
  122. </scroll-view>
  123. </view>
  124. </view>
  125. </uni-popup>
  126. <!-- <tui-picture-cropper v-if="cropperOption.imgUrl" :width="cropperOption.autoCropWidth" :height="cropperOption.autoCropHeight" :imageUrl="cropperOption.img" @ready="cropReady" @cropper="useCrop" @back="cropBack"></tui-picture-cropper> -->
  127. <!-- <tui-picture-cropper v-if="cropperOption1.imgUrl" :width="cropperOption1.autoCropWidth" :height="cropperOption1.autoCropHeight" :imageUrl="cropperOption1.img" @ready="cropReady1" @cropper="useCrop1" @back="cropBack1"></tui-picture-cropper> -->
  128. </view>
  129. </view></member-base>
  130. </template>
  131. <script>
  132. import {getFontSize} from '@/util/common'
  133. import TitleHeader from '../../TitleHeader'
  134. import MemberBase from '../MemberBase'
  135. import tuiPictureCropper from "@/components/thorui/tui-picture-cropper/tui-picture-cropper"
  136. import { mapState, mapMutations, mapActions } from 'vuex'
  137. import Step from '../../Step'
  138. import RegionPicker from '../../RegionPicker'
  139. import MapSelect from '../../MapSelect'
  140. import { getStoreJoinin, uploadInfoFile, saveStoreJoinin2 } from '../../../api/seller'
  141. import { getPointByAddress } from '../../../util/bmap'
  142. import flexLine from '../../flexLine'
  143. export default {
  144. components:{
  145. TitleHeader,
  146. MemberBase,
  147. flexLine,
  148. Step,
  149. RegionPicker,
  150. MapSelect,
  151. tuiPictureCropper
  152. },
  153. data(){
  154. return {
  155. navHeight: 0,
  156. business_author_letter_list:[],
  157. business_licence_number_electronic_lsit:[],
  158. screenWidth:0,
  159. screenHeight:0,
  160. // cropperOption: {
  161. // img: '',
  162. // canMove: false,
  163. // autoCrop: true,
  164. // autoCropWidth: 100,
  165. // autoCropHeight: 50,
  166. // maxImgSize: 500,
  167. // outputType: 'png'
  168. // },
  169. // cropperOption1: {
  170. // img: '',
  171. // canMove: false,
  172. // autoCrop: true,
  173. // autoCropWidth: 100,
  174. // autoCropHeight: 50,
  175. // maxImgSize: 500,
  176. // outputType: 'png'
  177. // },
  178. options: [{ title: '公司资质' }, { title: '财务资质' }, { title: '店铺信息' }, { title: '合同签订' }],
  179. showimage: '',
  180. selectData: '',
  181. regionName: '',
  182. dataName: ''
  183. }
  184. },
  185. mounted(){
  186. // #ifdef MP-WEIXIN
  187. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  188. // #endif
  189. const res = uni.getSystemInfoSync()
  190. this.screenWidth = res.windowWidth
  191. this.screenHeight = res.windowHeight
  192. },
  193. computed:{
  194. fontSize(){
  195. return getFontSize()
  196. },
  197. ...mapState({
  198. storeJoinin1: state => state.member.storeJoinin1,
  199. storeJoinin0: state => state.member.storeJoinin0,
  200. storeJoininType: state => state.member.storeJoininType,
  201. config: state => state.config.config
  202. }),
  203. storeJoinin:function(){
  204. var data
  205. if(this.storeJoininType==1){
  206. data = this.storeJoinin1
  207. }else{
  208. data = this.storeJoinin0
  209. }
  210. if(data.business_licence_number_electronic_url){
  211. this.business_licence_number_electronic_list = [{
  212. name: 'business_licence_number_electronic',
  213. extname: 'jpg',
  214. url: data.business_licence_number_electronic_url
  215. }]
  216. }
  217. if(data.business_author_letter_url){
  218. this.business_author_letter_list = [{
  219. name: 'business_author_letter',
  220. extname: 'jpg',
  221. url: data.business_author_letter_url
  222. }]
  223. }
  224. return data
  225. },
  226. getBannerStyle: function () {
  227. const res = uni.getSystemInfoSync()
  228. var width = res.windowWidth
  229. var height = res.windowHeight
  230. let itemWidth = width
  231. let itemHeight = height
  232. return "max-width:"+itemWidth +"px;max-height:"+itemHeight +"px"
  233. }
  234. },
  235. created: function () {
  236. getStoreJoinin().then(res => {
  237. var store_joinin = res.result.store_joinin
  238. if (store_joinin) {
  239. if (store_joinin.joinin_state == 11 || store_joinin.joinin_state == 20 || store_joinin.joinin_state == 31) {
  240. uni.redirectTo({url:'/pages/member/sellerjoinin/Step5'})
  241. return
  242. }
  243. if (store_joinin.joinin_state == 40) {
  244. uni.showToast({icon:'none',title: '您的店铺已开通'})
  245. return
  246. }
  247. this.sellerJoininSave({ storeJoinin: store_joinin })
  248. this.fetchConfig({}).then(
  249. response => {
  250. console.log('this.config' , this.config)
  251. if (this.config.store_joinin_open == 2 || this.config.store_joinin_open == 3) {
  252. if (this.config.store_joinin_open == 3) {
  253. this.storeJoinin['store_type'] = 1
  254. }
  255. if (this.config.store_joinin_open == 2) {
  256. this.storeJoinin['store_type'] = 0
  257. }
  258. this.$forceUpdate()
  259. }
  260. },
  261. error => {
  262. uni.showToast({icon:'none',title: error.message})
  263. }
  264. )
  265. console.log('this.storeJoinin' ,this.storeJoinin)
  266. }
  267. }).catch(error => {
  268. uni.showToast({icon:'none',title: error.message})
  269. })
  270. },
  271. methods:{
  272. showPopup(id){
  273. this.$refs[id].open()
  274. },
  275. hidePopup(id){
  276. this.$refs[id].close()
  277. },
  278. goBack(){uni.navigateBack({delta:1})},
  279. ...mapActions({
  280. fetchConfig: 'fetchConfig'
  281. }),
  282. ...mapMutations({
  283. memberPoint: 'memberPoint',
  284. sellerJoininSave: 'sellerJoininSave'
  285. }),
  286. nextStep () {
  287. saveStoreJoinin2(this.storeJoinin).then(res => {
  288. this.sellerJoininSave({ storeJoinin: this.storeJoinin })
  289. uni.navigateTo({url:'/pages/member/sellerjoinin/Step3'})
  290. }).catch(error => {
  291. uni.showToast({icon:'none',title: error.message})
  292. })
  293. },
  294. setPosition (lat, lng, name) {
  295. this.hidePopup('popMap')
  296. this.storeJoinin.company_address_detail = name
  297. this.storeJoinin.store_longitude = lng
  298. this.storeJoinin.store_latitude = lat
  299. this.$forceUpdate()
  300. },
  301. onPickerConfirm (values) {
  302. if (this.regionName == 'company_address') {
  303. this.storeJoinin.company_address = this.getRegionStr(values)
  304. this.storeJoinin.company_province_id = values[values.length - 1].area_id
  305. }
  306. if (this.regionName == 'business_licence_address') {
  307. this.storeJoinin.business_licence_address = this.getRegionStr(values)
  308. }
  309. this.selectCity(values.length > 1 ? values[1].area_name : values[0].area_name)
  310. this.$forceUpdate()
  311. },
  312. onRegion (name) {
  313. this.regionName = name
  314. this.$refs.picker.show()
  315. },
  316. getRegionStr (values) {
  317. let title = ''
  318. for (let i = 0; i < values.length; i++) {
  319. const element = values[i]
  320. if (i !== 0) {
  321. title = title + ' ' + element.area_name
  322. } else {
  323. title = title + element.area_name
  324. }
  325. }
  326. return title
  327. },
  328. openImage (src) {
  329. this.showimage = src
  330. this.showPopup('isshow')
  331. },
  332. lookImage (){
  333. const images = ['https://www.cctc365.com/uploads/home/store/p9ynd6H.png']
  334. uni.previewImage({
  335. current: 0, // 当前显示图片的索引值
  336. urls: images, // 需要预览的图片列表,photoList要求必须是数组
  337. loop:false,
  338. })
  339. },
  340. dropImage (type) {
  341. this.storeJoinin[type] = this.storeJoinin[type + '_url'] = ''
  342. // 缓存也要清除下
  343. this.$forceUpdate()
  344. },
  345. // dropImage1 () {
  346. // this.storeJoinin.business_author_letter = ''
  347. // this.$forceUpdate()
  348. // },
  349. // uploadImage(type,event) {
  350. // var file = event.tempFiles[0]
  351. // var that = this
  352. // that.cropperOption.imgUrl = file.path
  353. // that.cropperOption.autoCropWidth = uni.getSystemInfoSync().windowWidth
  354. // that.cropperOption.autoCropHeight =( uni.getSystemInfoSync().windowWidth) * (this.storeJoinin.store_type==0 ? 1 :.63)
  355. // that.cropperOption.maxImgSize = uni.getSystemInfoSync().windowHeight - 40
  356. // that.$forceUpdate()
  357. // },
  358. uploadSelectImg(type,event){
  359. const that = this
  360. const file = event.tempFiles[0]
  361. const formdata = {
  362. filePath: file.path,
  363. name: 'file'
  364. }
  365. uni.showLoading({
  366. title: '上传中....'
  367. })
  368. uploadInfoFile(formdata).then(res => {
  369. that.storeJoinin[type] = res.result.path
  370. that.storeJoinin[type + '_url'] = res.result.url
  371. that[type + '_list'] = [{
  372. name: type,
  373. extname: 'jpg',
  374. url: that.storeJoinin[type + '_url']
  375. }]
  376. // this.cropperOption.imgUrl = ''
  377. that.$forceUpdate()
  378. uni.hideLoading()
  379. }).catch(function(error) {
  380. uni.showToast({
  381. icon: 'none',
  382. title: error.message
  383. })
  384. uni.hideLoading()
  385. // this.cropperOption.imgUrl = ''
  386. that.$forceUpdate()
  387. })
  388. },
  389. // uploadImage1(event) {
  390. // var file = event.tempFiles[0]
  391. // console.log('这是我上传的图片',file)
  392. // var that = this
  393. // that.cropperOption1.imgUrl = file.path
  394. // that.cropperOption1.autoCropWidth = uni.getSystemInfoSync().windowWidth
  395. // that.cropperOption1.autoCropHeight = uni.getSystemInfoSync().windowWidth * (this.storeJoinin.store_type==0 ? 1.6 :.63)
  396. // that.cropperOption1.maxImgSize =uni.getSystemInfoSync().windowHeight -40
  397. // that.$forceUpdate()
  398. // },
  399. // useCrop(res) {
  400. // var formdata = {
  401. // filePath: res.url,
  402. // name: 'file'
  403. // }
  404. // uni.showLoading({
  405. // title: '加载中'
  406. // })
  407. // uploadInfoFile(formdata).then(res => {
  408. // this.storeJoinin.business_licence_number_electronic = res.result.path
  409. // this.storeJoinin.business_licence_number_electronic_url = res.result.url
  410. // this.imageValue = [{
  411. // name: 'business_licence_number_electronic',
  412. // extname: 'jpg',
  413. // url: this.storeJoinin.business_licence_number_electronic_url
  414. // }]
  415. // this.cropperOption.imgUrl = ''
  416. // this.$forceUpdate()
  417. // uni.hideLoading()
  418. // }).catch(function(error) {
  419. // uni.showToast({
  420. // icon: 'none',
  421. // title: error.message
  422. // })
  423. // uni.hideLoading()
  424. // this.cropperOption.imgUrl = ''
  425. // this.$forceUpdate()
  426. // })
  427. // },
  428. // useCrop1(res) {
  429. // var formdata = {
  430. // filePath: res.url,
  431. // name: 'file'
  432. // }
  433. // uni.showLoading({
  434. // title: '加载中'
  435. // })
  436. // uploadInfoFile(formdata).then(res => {
  437. // this.storeJoinin.business_author_letter = res.result.path
  438. // this.storeJoinin.business_author_letter_url = res.result.url
  439. // this.imageValue1 = [{
  440. // name: 'business_author_letter',
  441. // extname: 'jpg',
  442. // url: this.storeJoinin.business_author_letter_url
  443. // }]
  444. // this.cropperOption1.imgUrl = ''
  445. // this.$forceUpdate()
  446. // uni.hideLoading()
  447. // }).catch(function(error) {
  448. // uni.showToast({
  449. // icon: 'none',
  450. // title: error.message
  451. // })
  452. // uni.hideLoading()
  453. // this.cropperOption1.imgUrl = ''
  454. // this.$forceUpdate()
  455. // })
  456. // },
  457. // cropReady() {
  458. // this.cropperOption.img = this.cropperOption.imgUrl
  459. // },
  460. // cropReady1() {
  461. // this.cropperOption1.img = this.cropperOption1.imgUrl
  462. // },
  463. //cropBack(){
  464. // this.cropperOption.imgUrl=''
  465. // this.$forceUpdate()
  466. // },
  467. // cropBack1(){
  468. // this.cropperOption1.imgUrl=''
  469. // this.$forceUpdate()
  470. // },
  471. selectCity (city_name) {
  472. getPointByAddress(city_name).then(res => {
  473. if (res.result.location) {
  474. var lng = res.result.location.lng
  475. var lat = res.result.location.lat
  476. if (this.regionName == 'company_address') {
  477. this.storeJoinin.store_latitude = lat
  478. this.storeJoinin.store_longitude = lng
  479. }
  480. if (this.regionName == 'business_licence_address') {
  481. }
  482. this.memberPoint({ point: { lng: lng, lat: lat, address: res.result.sematic_description, cityCode: res.result.cityCode, cityName: city_name } })
  483. this.$forceUpdate()
  484. } else {
  485. uni.showToast({icon:'none',title: '无法获取城市位置'})
  486. }
  487. }).catch(function (error) {
  488. uni.showToast({icon:'none',title: error.message})
  489. })
  490. }
  491. }
  492. }
  493. </script>
  494. <style lang="scss" scoped>
  495. .common-header{
  496. .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
  497. }
  498. .main-content{background: #fff;padding:0 $pageSpace}
  499. .container {
  500. background: #fff;
  501. }
  502. .label {
  503. padding: .5rem;
  504. font-size:$h2;
  505. background: #eee;
  506. }
  507. .look-button{
  508. margin-top:.5rem; ;
  509. color: #999;
  510. font-weight: 400;
  511. }
  512. </style>