Step2.vue 18 KB

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