123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- <template>
- <view>
- <view v-if="detail.templateType!=null">
- <u-line color="#D6D6DB" />
- <view v-if="detail.templateType=='class'" style="display: flex;justify-content: space-between;align-items: center;height: 50rpx;" @click="openPopup(0)">
- <view style="color: #666666;font-size: 24rpx;">{{gradeIndex<0?'选择班级':gradeList[gradeIndex].className}}</view>
- <view><u-icon name="arrow-right" color="#999999" size="28"></u-icon></view>
- </view>
- <view v-if="detail.templateType=='apply'" style="display: flex;justify-content: space-between;align-items: center;height: 50rpx;" @click="openPopup(1)">
- <view style="color: #666666;font-size: 24rpx;" >{{gradeIndex<0?'报考地区':gradeList[gradeIndex].className}}</view>
- <view><u-icon name="arrow-right" color="#999999" size="28"></u-icon></view>
- </view>
- </view>
-
- <u-popup v-model="show" mode="bottom"border-radius="40">
- <view class="popup_box">
- <view style="margin-bottom: 20rpx;">
- <view class="line1"></view>
- <view class="grade">选择班级</view>
- </view>
- <u-line color="#D6D6DB" />
- <view>
- <scroll-view scroll-y="true" style="height: 500rpx;">
- <view>
- <u-radio-group v-model="gradeValue" @change="radioGroupChange">
- <view v-for="(item, index) in gradeList" :key="index" >
- <view style="display: flex;align-items: center;padding: 20rpx;">
- <view>
- <u-radio
- shape="circle"
- :name="index"
- ></u-radio>
- </view>
- <view :class="item.checked?'white-box blue-box':'white-box'" >
- <view>
- <view class="blackTxt">{{item.className}}</view>
- <view class="redTxt" v-if="item.classEndTime">有效期至:{{$method.timestampToTime(item.classEndTime)}}</view>
- <view class="redTxt" v-if="item.classEndTime">本班还剩{{$method.GetRTime(item.classEndTime)}}天将结束学习</view>
- </view>
- </view>
- </view>
- </view>
- </u-radio-group>
- </view>
- </scroll-view>
- </view>
- <view class="confrim-btn">
- <view class="okBtn" @click="okPopup(0)">确定</view>
- </view>
- </view>
- </u-popup>
- <u-popup v-model="show1" mode="bottom"border-radius="40">
- <view class="popup_box">
- <view style="margin-bottom: 20rpx;">
- <view class="line1"></view>
- <view class="grade">选择考期/地区</view>
- </view>
- <u-line color="#D6D6DB" />
- <view style="display: flex;height: 500rpx;">
- <view style="width: 50%;">
- <view class="topTxt">考期</view>
- <view>
- <picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChangeE" class="picker-view">
- <picker-view-column>
- <view class="picker-item" v-for="(item,index) in examine" :key="index">{{item.examineName}}</view>
- </picker-view-column>
- </picker-view>
- </view>
- </view>
- <view style="width: 50%;">
- <view class="topTxt">地区</view>
- <view>
- <picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChange" class="picker-view">
- <picker-view-column>
- <view class="picker-item" v-for="(item,index) in provinceList" :key="index">{{item.areaName}}</view>
- </picker-view-column>
- <picker-view-column>
- <view class="picker-item" v-for="(item,index) in cityList" :key="index">{{item.areaName}}</view>
- </picker-view-column>
- </picker-view>
- </view>
- </view>
- </view>
- <view class="confrim-btn">
- <view class="okBtn" @click="okPopup(1)">确定</view>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import { mapGetters } from 'vuex';
- export default {
- name: 'goodsInputItem',
- props: {
- detail: {
- type: Object,
- default: {}
- }
- },
- data() {
- return {
- gradeValue:-1,
- gradeIndex:-1,
- show:false,
- show1:false,
- indicatorStyle: `height: 50px;`,
- gradeList:[],
- provinceList:[],
- cityList:[],
- pAreaIndex:0,
- cAreaIndex:0,
- examine:[],
- eAreaIndex:0,
- applyObj:{
- applyAreasJson:null,
- examDateJson:null
- }
-
- };
- },
- onLoad() {},
- created() {
-
- },
- mounted() {
-
- },
- methods: {
- openPopup(index){
- if(index==0){
- this.show = true
- this.goodsGradeList()
- }else{
- this.show1 = true
- this.getProvinceList()
- }
-
- },
- okPopup(index){
- if(index==0){
- if(!this.checkData()){
- return
- }
- this.gradeIndex = this.gradeValue
- this.show = false
- }else{
- let examDate =
- this.show1 = false
- }
- },
- checkData(){
- if(this.detail.templateType=='class'){
- if(this.gradeValue<0){
- uni.showModal({
- title: "提示",
- content: '请选择班级',
- showCancel: false
- })
- return false
- }
- }
- else if(this.detail.templateType=='apply'){
- if(!this.applyObj.applyAreasJson){
- uni.showModal({
- title: "提示",
- content: '请选择报考地区',
- showCancel: false
- })
- return false
- }
- if(!this.applyObj.examDateJson){
- uni.showModal({
- title: "提示",
- content: '请选择考期',
- showCancel: false
- })
- return false
- }
- }
- return true;
- },
- bindChangeE(e){
- console.log(e.detail.value)
- },
- bindChange(e) {
- const val = e.detail.value
- if(this.pAreaIndex!=e.detail.value[0]){
- this.pAreaIndex = e.detail.value[0]
- this.getCityList(this.provinceList[this.pAreaIndex].areaId)
- }
- if(this.cAreaIndex!=e.detail.value[1]){
- this.cAreaIndex = e.detail.value[1]
- }
-
- },
- getExamine(id) {
- let self = this
- this.$api.getExamine({projectId:id}).then(res => {
- if(res.data.code==200){
- self.examine = res.data.rows
- }
- });
- },
- getCityList(id) {
- let self = this
- this.$api.getCityList({parentId:id}).then(res => {
- if(res.data.code==200){
- self.cityList = res.data.rows
- }
- });
- },
- getProvinceList() {
- let self = this
- if(self.provinceList.length>0){
- return
- }
- this.$api.getProvinceList().then(res => {
- if(res.data.code==200){
- self.provinceList = res.data.rows
- if(self.provinceList.length>0){
- self.getCityList(self.provinceList[0].areaId)
- }
-
- }
- });
- },
- },computed: { ...mapGetters([]) },
- };
- </script>
- <style scoped>
- .icon_up{
- width: 24rpx;
- height: 24rpx;
- }
- .title{
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #666666;
- white-space:nowrap;
- overflow:hidden;
- text-overflow:ellipsis;
- }
- </style>
|