Step2.vue 19 KB

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