Step2.vue 15 KB

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