Step2.vue 18 KB

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