| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <template>
- <view>
- <view class="industry">
- <view class="left">
- <view :class="'li dflex' + (checkIndex == index ? ' active':'')" v-for="(item,index) in industryList" :key="index" @click="checkIndustry(index)">
- {{item.name}}
- </view>
- </view>
- <view class="right">
- <view :class="'li' + (arrayIndex == index ? ' active':'')" v-for="(item,index) in rightArray" :key="index" @click="checkArray(index)">
- {{item.name}}
- </view>
- </view>
- </view>
- <view class="btn" @click="save()">确定</view>
- </view>
- </template>
- <script>
- const req = require('../../utils/request.js');
- const api = require('../../utils/api.js');
- const util = require('../../utils/util.js');
- var app = getApp();
- export default {
- data() {
- return {
- industryList: [],
- checkIndex: 0,
- rightArray: [],
- arrayIndex: -1,
- industryName: '',
- tradeId: ''
- };
- },
- onLoad() {
- this.getIndustry();
- },
- methods: {
- getIndustry() {
- req.getRequest(api.company_industry, {}, json => {
- this.industryList = json;
- this.rightArray = json[0].children;
- });
- },
- checkIndustry(index){
- if(this.checkIndex == index) return false;
- this.checkIndex = index;
- this.rightArray = this.industryList[this.checkIndex].children;
- this.arrayIndex=-1;
- },
- checkArray(index){
- if(this.arrayIndex == index) return false;
- this.arrayIndex = index;
- this.industryName = this.rightArray[this.arrayIndex].name;
- this.tradeId = this.rightArray[this.arrayIndex].id;
- },
- save(){
- if(this.arrayIndex < 0) return req.msg('请选择行业');
- let pages = getCurrentPages(); //获取所有页面栈实例列表
- let nowPage = pages[ pages.length - 1]; //当前页页面实例
- let prevPage = pages[ pages.length - 2 ]; //上一页页面实例
- prevPage.$vm.industryName = this.industryName; //修改上一页面的 couponNumber 参数值为 value
- prevPage.$vm.tradeId = this.tradeId; //修改上一页面的 couponNumber 参数值为 value
- uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
- delta: 1
- });
- }
- }
- };
- </script>
- <style>
- @import "./industry.css";
- </style>
|