Step4.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  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="2"></step>
  13. <view class="div main-content">
  14. <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.store_name" /></view></flex-line>
  15. <view class="div" @click="showPopup('showStoreGrade')"><flex-line :is-link="true" :show-border="true"><text class="span line-name">店铺等级</text><text class="span" slot="right">{{storeJoinin.storegrade_name}}</text></flex-line></view>
  16. <view class="div" @click="showPopup('showStoreTime')"><flex-line :is-link="true" :show-border="true"><text class="span line-name">开店时长</text><text class="span" slot="right">{{storeJoinin.joinin_year?(storeJoinin.joinin_year+'年'):''}}</text></flex-line></view>
  17. <view class="div" @click="showPopup('showStoreClass')"><flex-line :is-link="true" :show-border="true"><text class="span line-name">店铺分类</text><text class="span" slot="right">{{storeJoinin.storeclass_name}}</text></flex-line></view>
  18. <view class="div" @click="showPopup('showGoodsClass')"><flex-line :is-link="true" :show-border="true"><text class="span line-name">经营类目</text></flex-line></view>
  19. </view>
  20. <view class="div common-btn ds-button-large mt-10" @click="nextStep">提交</view>
  21. <view class="div">
  22. <uni-popup background-color="#fff" ref="showGoodsClass" type="right" >
  23. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  24. <view class="div common-header-wrap">
  25. <view :style="'height:'+navHeight+'px'"></view>
  26. <view class="common-header-holder"></view>
  27. <view class="common-header-fixed">
  28. <title-header />
  29. <uni-nav-bar title="经营类目" class="common-header" left-icon="back" @clickLeft="hidePopup('showGoodsClass')">
  30. </uni-nav-bar>
  31. </view>
  32. </view>
  33. <view class="div common-popup-content" v-if="storeJoinin.store_class_names">
  34. <scroll-view class="pb-30" style="position: absolute;top:0;right:0;left:0;bottom:0" scroll-y="true">
  35. <view class="div main-content" v-for="(goods_class,index) in storeJoinin.store_class_names" :key="index" @click="classIndex=index;showPopup('classVisible')">
  36. <flex-line :show-border="true"><text class="span line-name">{{goods_class?goods_class:'请选择分类'}}</text><text class="span" slot="right">{{(storeJoinin.store_class_commis_rates && storeJoinin.store_class_commis_rates[index])?(storeJoinin.store_class_commis_rates[index]+'%'):''}}</text></flex-line>
  37. </view>
  38. </scroll-view>
  39. <view class='common-add-btn-wrapper'><view class="div common-btn common-add-btn" @click="addGoodsClass">新增</view></view>
  40. </view>
  41. </view>
  42. </uni-popup>
  43. </view>
  44. <view class="div">
  45. <uni-popup background-color="#fff" ref="classVisible" type="bottom">
  46. <view class="container">
  47. <view class="div toolbar">
  48. <text class="button toolbar-item cancel-item" @click="cancelClass">取消</text>
  49. <view class="div picker-header">选择经营分类</view>
  50. <text class="button toolbar-item confirm-item" @click="confirmClass">确定</text>
  51. </view>
  52. <picker-view class="popup-content" indicator-style="height:80rpx" @change="onClassChange" :value="gcPicker">
  53. <picker-view-column v-for="(item,index) in buildItems" :key="index">
  54. <view class="popup-item-wrapper" v-for="(v,i) in item.values" :key="i"><text class="popup-item">{{v.value}}</text></view>
  55. </picker-view-column>
  56. </picker-view>
  57. </view>
  58. </uni-popup>
  59. <uni-popup background-color="#fff" ref="showStoreClass" type="bottom">
  60. <view class="container">
  61. <view class="div toolbar">
  62. <text class="button toolbar-item cancel-item" @click="cancelStoreClass">取消</text>
  63. <view class="div picker-header">选择店铺分类</view>
  64. <text class="button toolbar-item confirm-item" @click="confirmStoreClass">确定</text>
  65. </view>
  66. <picker-view class="popup-content" indicator-style="height:80rpx" @change="onStoreClassChange" :value="scPicker">
  67. <picker-view-column v-for="(item,index) in store_class_options" :key="index">
  68. <view class="popup-item-wrapper" v-for="(v,i) in item.values" :key="i"><text class="popup-item">{{v.storeclass_name}}</text></view>
  69. </picker-view-column>
  70. </picker-view>
  71. </view>
  72. </uni-popup>
  73. <uni-popup background-color="#fff" ref="showStoreGrade" type="bottom">
  74. <view class="container">
  75. <view class="div toolbar">
  76. <text class="button toolbar-item cancel-item" @click="cancelStoreGrade">取消</text>
  77. <view class="div picker-header">选择店铺等级</view>
  78. <text class="button toolbar-item confirm-item" @click="confirmStoreGrade">确定</text>
  79. </view>
  80. <picker-view class="popup-content" indicator-style="height:80rpx" @change="onStoreGradeChange" :value="sgPicker">
  81. <picker-view-column v-for="(item,index) in store_grade_options" :key="index">
  82. <view class="popup-item-wrapper" v-for="(v,i) in item.values" :key="i"><text class="popup-item">{{v.storegrade_name}}</text></view>
  83. </picker-view-column>
  84. </picker-view>
  85. </view>
  86. </uni-popup>
  87. <uni-popup background-color="#fff" ref="showStoreTime" type="bottom">
  88. <view class="container">
  89. <view class="div toolbar">
  90. <text class="button toolbar-item cancel-item" @click="cancelStoreTime">取消</text>
  91. <view class="div picker-header">选择开店时长</view>
  92. <text class="button toolbar-item confirm-item" @click="confirmStoreTime">确定</text>
  93. </view>
  94. <picker-view class="popup-content" indicator-style="height:80rpx" @change="onStoreTimeChange" :value="stPicker">
  95. <picker-view-column v-for="(item,index) in store_time_options" :key="index">
  96. <view class="popup-item-wrapper" v-for="(v,i) in item.values" :key="i"><text class="popup-item">{{v.time_text}}</text></view>
  97. </picker-view-column>
  98. </picker-view>
  99. </view>
  100. </uni-popup>
  101. </view>
  102. </view></member-base>
  103. </template>
  104. <script>
  105. import {getFontSize} from '@/util/common'
  106. import TitleHeader from '../../TitleHeader'
  107. import MemberBase from '../MemberBase'
  108. import { mapState, mapMutations, mapActions } from 'vuex'
  109. import Step from '../../Step'
  110. import { getStoreClass, getStoreGrade, getStoreJoinin, saveStoreJoinin4 } from '../../../api/seller'
  111. import flexLine from '../../flexLine'
  112. export default {
  113. components:{
  114. TitleHeader,
  115. MemberBase,
  116. flexLine,
  117. Step
  118. },
  119. data(){
  120. return {
  121. navHeight: 0,
  122. stPicker:[0],
  123. sgPicker:[0],
  124. scPicker:[0],
  125. gcPicker:[0,0,0],
  126. screenWidth:0,
  127. options: [{ title: '公司资质' }, { title: '财务资质' }, { title: '店铺信息' }, { title: '合同签订' }],
  128. store_class_options: [],
  129. store_grade_options: [],
  130. goods_class: {},
  131. store_time_options: [{
  132. flex: 1,
  133. values: [{ time_number: 1, time_text: '1年' }, { time_number: 2, time_text: '2年' }],
  134. textAlign: 'center'
  135. }],
  136. classIndex: 0
  137. }
  138. },
  139. mounted(){
  140. // #ifdef MP-WEIXIN
  141. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  142. // #endif
  143. this.screenWidth=uni.getSystemInfoSync().screenWidth
  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. items: state => state.goodsclass.items,
  154. config: state => state.config.config
  155. }),
  156. storeJoinin:function(){
  157. if(this.storeJoininType==1){
  158. return this.storeJoinin1
  159. }else{
  160. return this.storeJoinin0
  161. }
  162. },
  163. buildItems: function () {
  164. if (!this.items || !this.items[0]) {
  165. return []
  166. }
  167. let items = new Array()
  168. this.getDefaultItems(this.items, items)
  169. return items
  170. }
  171. },
  172. created: function () {
  173. if (!this.storeJoinin.store_class_names || !this.storeJoinin.store_class_names.length) {
  174. this.storeJoinin.store_class_names = ['']
  175. }
  176. getStoreJoinin().then(res => {
  177. var store_joinin = res.result.store_joinin
  178. if (store_joinin) {
  179. if (store_joinin.joinin_state == 11 || store_joinin.joinin_state == 20 || store_joinin.joinin_state == 31) {
  180. uni.redirectTo({url:'/pages/member/sellerjoinin/Step5'})
  181. return
  182. }
  183. if (store_joinin.joinin_state == 40) {
  184. uni.showToast({icon:'none',title: '您的店铺已开通'})
  185. return
  186. }
  187. // if (!this.storeJoinin) {
  188. this.sellerJoininSave({ storeJoinin: store_joinin })
  189. this.fetchConfig({}).then(
  190. response => {
  191. if(this.config.store_joinin_open==2 || this.config.store_joinin_open==3){
  192. if(this.config.store_joinin_open==3){
  193. this.storeJoinin['store_type']=1
  194. }
  195. if(this.config.store_joinin_open==2){
  196. this.storeJoinin['store_type']=0
  197. }
  198. this.$forceUpdate()
  199. }
  200. },
  201. error => {
  202. uni.showToast({icon:'none',title: error.message})
  203. }
  204. )
  205. // } else {
  206. this.isSame = !!this.storeJoinin.is_settlement_account
  207. if (!this.storeJoinin.store_class_names || !this.storeJoinin.store_class_names.length) {
  208. this.storeJoinin.store_class_names = ['']
  209. }
  210. // }
  211. }
  212. }).catch(error => {
  213. uni.showToast({icon:'none',title: error.message})
  214. })
  215. this.fetchGoodsclassList()
  216. getStoreClass().then(res => {
  217. var store_class = res.result.store_class
  218. this.store_class_options = [{
  219. flex: 1,
  220. values: store_class,
  221. textAlign: 'center'
  222. }]
  223. }).catch(error => {
  224. uni.showToast({icon:'none',title: error.message})
  225. })
  226. getStoreGrade().then(res => {
  227. var store_grade = res.result.storegrade_list
  228. this.store_grade_options = [{
  229. flex: 1,
  230. values: store_grade,
  231. textAlign: 'center'
  232. }]
  233. }).catch(error => {
  234. uni.showToast({icon:'none',title: error.message})
  235. })
  236. },
  237. methods:{
  238. showPopup(id){
  239. this.$refs[id].open()
  240. },
  241. hidePopup(id){
  242. this.$refs[id].close()
  243. },
  244. goBack(){uni.navigateBack({delta:1})},
  245. ...mapActions({
  246. fetchConfig: 'fetchConfig',
  247. fetchGoodsclassList: 'fetchGoodsclassList'
  248. }),
  249. ...mapMutations({
  250. sellerJoininSave: 'sellerJoininSave'
  251. }),
  252. nextStep () {
  253. if(!this.config){
  254. uni.showToast({icon:'none',title: '请稍等'})
  255. return
  256. }
  257. saveStoreJoinin4(this.storeJoinin).then(res => {
  258. this.sellerJoininSave({ storeJoinin: this.storeJoinin })
  259. uni.redirectTo({url:'/pages/member/sellerjoinin/Step5'})
  260. }).catch(error => {
  261. uni.showToast({icon:'none',title: error.message})
  262. })
  263. },
  264. addGoodsClass () {
  265. if (!this.storeJoinin.store_class_names) {
  266. this.storeJoinin.store_class_names = []
  267. }
  268. this.storeJoinin.store_class_names.push('')
  269. this.$forceUpdate()
  270. },
  271. getDefaultItems (_item, defaultItems) {
  272. defaultItems.push({
  273. flex: 1,
  274. values: _item,
  275. textAlign: 'center'
  276. })
  277. defaultItems.push({
  278. flex: 1,
  279. values: _item[0].children,
  280. textAlign: 'center'
  281. })
  282. defaultItems.push({
  283. flex: 1,
  284. values: (_item[0].children && _item[0].children.length) ? _item[0].children[0].children : [],
  285. textAlign: 'center'
  286. })
  287. },
  288. cancelClass () {
  289. this.hidePopup('classVisible')
  290. },
  291. confirmClass () {
  292. let values = []
  293. for(var i in this.gcPicker){
  294. values[i]=this.buildItems[i]['values'][this.gcPicker[i]]
  295. if(!values[i]){
  296. values[i]={
  297. id:0,
  298. value:''
  299. }
  300. }
  301. }
  302. if (!this.storeJoinin.store_class_ids) {
  303. this.storeJoinin.store_class_ids = []
  304. }
  305. if (!this.storeJoinin.store_class_commis_rates) {
  306. this.storeJoinin.store_class_commis_rates = []
  307. }
  308. var store_class_names = ''
  309. var store_class_ids = ''
  310. var index=0
  311. for (var i in values) {
  312. if(values[i].id){
  313. index=i
  314. if (!store_class_names) {
  315. store_class_names = values[i].value
  316. store_class_ids = values[i].id
  317. } else {
  318. store_class_names += ',' + values[i].value
  319. store_class_ids += ',' + values[i].id
  320. }
  321. }
  322. }
  323. this.storeJoinin.store_class_names[this.classIndex] = store_class_names
  324. this.storeJoinin.store_class_ids[this.classIndex] = store_class_ids
  325. this.storeJoinin.store_class_commis_rates[this.classIndex] = values[index].commis_rate
  326. this.hidePopup('classVisible')
  327. this.$forceUpdate()
  328. },
  329. onStoreClassChange(e){
  330. this.scPicker=e.detail.value
  331. },
  332. onStoreGradeChange(e){
  333. this.sgPicker=e.detail.value
  334. },
  335. onStoreTimeChange(e){
  336. this.stPicker=e.detail.value
  337. },
  338. onClassChange (e) {
  339. let value=e.detail.value
  340. let gcPicker=this.gcPicker
  341. for(var i in value){
  342. gcPicker[i]=value[i]
  343. i=parseInt(i)
  344. if(i<(value.length-1)){
  345. if(!this.buildItems[i]['values'].length || !this.buildItems[i]['values'][value[i]]['children'] || !this.buildItems[i]['values'][value[i]]['children'].length){
  346. this.buildItems[i+1]['values']=[]
  347. gcPicker[i+1]=0
  348. }else if(!this.buildItems[i+1]['values'].length || this.buildItems[i]['values'][value[i]]['children'][0]['id']!=this.buildItems[i+1]['values'][0]['id']){
  349. this.buildItems[i+1]['values']=this.buildItems[i]['values'][value[i]]['children']
  350. gcPicker[i+1]=0
  351. }
  352. }
  353. }
  354. this.gcPicker=gcPicker
  355. this.$forceUpdate()
  356. },
  357. cancelStoreClass () {
  358. this.hidePopup('showStoreClass')
  359. },
  360. confirmStoreClass () {
  361. let values = this.store_class_options[0]['values'][this.scPicker[0]]
  362. this.storeJoinin.storeclass_name = values.storeclass_name
  363. this.storeJoinin.storeclass_id = values.storeclass_id
  364. this.hidePopup('showStoreClass')
  365. this.$forceUpdate()
  366. },
  367. cancelStoreGrade () {
  368. this.hidePopup('showStoreGrade')
  369. },
  370. confirmStoreGrade () {
  371. let values = this.store_grade_options[0]['values'][this.sgPicker[0]]
  372. this.storeJoinin.storegrade_name = values.storegrade_name
  373. this.storeJoinin.storegrade_id = values.storegrade_id
  374. this.hidePopup('showStoreGrade')
  375. this.$forceUpdate()
  376. },
  377. cancelStoreTime () {
  378. this.hidePopup('showStoreTime')
  379. },
  380. confirmStoreTime () {
  381. let values = this.store_time_options[0]['values'][this.stPicker[0]]
  382. this.storeJoinin.joinin_year = values.time_number
  383. this.hidePopup('showStoreTime')
  384. this.$forceUpdate()
  385. },
  386. }
  387. }
  388. </script>
  389. <style lang="scss" scoped>
  390. .common-header{
  391. .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
  392. }
  393. .main-content{background: #fff;padding:0 $pageSpace}
  394. .common-popup-content{padding:0 $pageSpace;box-sizing:border-box}
  395. .container {
  396. background: #fff;
  397. }
  398. .label {
  399. padding: .5rem;
  400. font-size:$h2;
  401. background: #eee;
  402. }
  403. .toolbar {
  404. height: 2rem;
  405. display: flex;
  406. flex-direction: row;
  407. justify-content: space-between;
  408. align-items: center;
  409. background-color: #f0f2f5;
  410. .toolbar-item {
  411. font-size:$fontSize;
  412. border: none;
  413. border-radius: 0;
  414. background-color: #f0f2f5;
  415. }
  416. .cancel-item {
  417. margin-left: 0.5rem;
  418. color: #4e545d;
  419. }
  420. .confirm-item {
  421. margin-right: 0.5rem;
  422. color: red;
  423. }
  424. .picker-header {
  425. color: #4e545d;
  426. line-height: 2rem;
  427. font-size:$h2;
  428. }
  429. }
  430. .popup-content {
  431. padding: 0 40rpx;
  432. height: 300rpx;
  433. }
  434. .popup-item-wrapper{
  435. display: flex;
  436. justify-content: center;
  437. align-items: center;
  438. }
  439. .popup-item {
  440. font-size: 30rpx;
  441. line-height:80rpx;
  442. text-align: center;
  443. overflow: hidden;
  444. text-overflow: ellipsis;
  445. white-space: nowrap;
  446. }
  447. </style>