123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489 |
- <template>
- <view class="gradeActive">
- <view class="headerBg"></view>
- <view class="header" :style="{backgroundImage:'url('+imgHost+'/statics/images/grade-active.png'+')'}">
- <view class="title">激活会员卡</view>
- <view>新用户免费激活会员卡</view>
- </view>
- <view class="conter">
- <view class="headerT acea-row row-center-wrapper">
- <view class="pictrue">
- <image src="../static/left.png"></image>
- </view>
- <view class="name">{{list.length?'填写以下信息':'我的成长特权'}}</view>
- <view class="pictrue on">
- <image src="../static/left.png"></image>
- </view>
- </view>
- <view class="list acea-row row-between-wrapper" v-if="!list.length">
- <view class="itemNo">
- <view class="pictrue">
- <image :src="imgHost+'/statics/images/userVip1.png'"></image>
- </view>
- <view>购物折扣</view>
- </view>
- <view class="itemNo">
- <view class="pictrue">
- <image :src="imgHost+'/statics/images/userVip2.png'"></image>
- </view>
- <view>专属徽章</view>
- </view>
- <view class="itemNo">
- <view class="pictrue">
- <image :src="imgHost+'/statics/images/userVip3.png'"></image>
- </view>
- <view>经验累积</view>
- </view>
- <view class="itemNo">
- <view class="pictrue">
- <image :src="imgHost+'/statics/images/userVip4.png'"></image>
- </view>
- <view>尊享客服</view>
- </view>
- <image class="vipBg" src="../static/vipBg.png"></image>
- </view>
- <view class="item" v-for="(item,index) in list" :key="index">
- <view class="name"><text class="asterisk" v-if="item.required==1">*</text><text>{{item.info}}</text></view>
-
- <view class="input" v-if="item.format == 'text'">
- <input type="text" :placeholder="item.tip" placeholder-class="placeholder" v-model="item.value" />
- </view>
-
- <view class="input" v-if="item.format=='num'">
- <input type="number" :placeholder="item.tip" placeholder-class="placeholder" v-model="item.value" />
- </view>
-
- <view class="input" v-if="item.format=='mail'">
- <input type="text" :placeholder="item.tip" placeholder-class="placeholder" v-model="item.value" />
- </view>
-
- <view class="input" v-if="item.format=='date'">
- <picker mode="date" :value="item.value" @change="bindDateChange($event,index)">
- <view class="acea-row row-between-wrapper">
- <view v-if="item.value == ''">{{item.tip}}</view>
- <view v-else>{{item.value}}</view>
- <text class='iconfont icon-jiantou'></text>
- </view>
- </picker>
- </view>
-
- <view class="input" v-if="item.format=='id'">
- <input type="idcard" :placeholder="item.tip" placeholder-class="placeholder" v-model="item.value" />
- </view>
-
- <view class="input" v-if="item.format=='phone'">
- <input type="tel" :placeholder="item.tip" placeholder-class="placeholder" v-model="item.value" />
- </view>
-
- <view class="input" v-if="item.format=='radio'">
- <radio-group @change="radioChange($event,index)">
- <label class="label">
- <radio value="0" :checked="item.value == 0" />{{item.singlearr[0]}}
- </label>
- <label>
- <radio value="1" :checked="item.value == 1" />{{item.singlearr[1]}}
- </label>
- </radio-group>
- </view>
-
- <view class="input" @click="addressList" v-if="item.format=='address'">
- <picker mode="multiSelector" @change="bindRegionChange($event,index)"
- @columnchange="bindMultiPickerColumnChange" :value="valueRegion"
- :range="multiArray">
- <view class='acea-row row-between-wrapper'>
- <view class="picker">{{region[0]}},{{region[1]}},{{region[2]}}</view>
- <text class='iconfont icon-jiantou'></text>
- </view>
- </picker>
- </view>
- </view>
- </view>
- <view class="bnt" @click="activate">确认激活</view>
- <ewcomerPop v-if="isComerGift" :fromActive="1" :comerGift="comerGift" @comerPop="comerPop"></ewcomerPop>
- </view>
- </template>
- <script>
- import {
- levelInfo,
- levelActivate
- } from '@/api/user.js';
- import {
- getCity
- } from '@/api/api.js';
- import {
- HTTP_REQUEST_URL
- } from '@/config/app';
- import ewcomerPop from '@/components/ewcomerPop/index.vue'
- export default {
- components: {
- ewcomerPop
- },
- data() {
- return {
- imgHost: HTTP_REQUEST_URL,
- list:[],
- district: [],
- multiArray: [],
- multiIndex: [0, 0, 0],
- valueRegion: [0, 0, 0],
- region: ['省', '市', '区'],
- comerGift:{},
- isComerGift:false
- };
- },
- onLoad() {
- this.getInfo();
- },
- onReady() {},
- onShow() {},
- methods: {
- comerPop(){
- this.isComerGift = false;
- uni.navigateTo({
- url: '/pages/annex/vip_grade/index'
- })
- },
- activate(){
- let that = this;
- for (var i = 0; i < that.list.length; i++) {
- let data = that.list[i]
- if (data.required || data.value) {
- if (data.format === 'date' || data.format === 'address') {
- if (!data.value) {
- return that.$util.Tips({
- title: `${data.tip}`
- });
- }
- }
- if(data.format === 'text'){
- if (!data.value.trim()) {
- return that.$util.Tips({
- title: `${data.tip}`
- });
- }
- }
- if (data.format === 'num') {
- if (data.value <= 0) {
- return that.$util.Tips({
- title: `${data.tip}`
- });
- }
- }
- if (data.format === 'mail') {
- if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(data.value)) {
- return that.$util.Tips({
- title: `${data.tip}`
- });
- }
- }
- if (data.format === 'phone') {
- if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(data.value)) {
- return that.$util.Tips({
- title: `${data.tip}`
- });
- }
- }
- if (data.format === 'id') {
- if (!/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/i.test(data.value)) {
- return that.$util.Tips({
- title: `${data.tip}`
- });
- }
- }
- }
- }
- levelActivate(this.list).then(res=>{
- res.data['register_give_integral'] = res.data.level_give_integral;
- res.data['register_give_money'] = res.data.level_give_money;
- res.data['register_give_coupon'] = res.data.level_give_coupon;
- res.data['coupon_count'] = res.data.level_give_coupon.length;
- this.comerGift = res.data;
- if(res.data.level_give_integral>0 || res.data.level_give_money>0 || res.data.level_give_coupon.length>0){
- this.isComerGift = true;
- }else{
- uni.navigateTo({
- url: '/pages/annex/vip_grade/index'
- })
- }
- }).catch(err=>{
- return this.$util.Tips({
- title: err
- });
- })
- },
-
- addressList(){
- this.getCityList();
- },
-
- getCityList() {
- let that = this;
- getCity().then(res => {
- this.district = res.data
- that.initialize();
- })
- },
-
- initialize: function() {
- let that = this,
- province = [],
- city = [],
- area = [];
- if (that.district.length) {
- let cityChildren = that.district[0].c || [];
- let areaChildren = cityChildren.length ? (cityChildren[0].c || []) : [];
- that.district.forEach(function(item) {
- province.push(item.n);
- });
- cityChildren.forEach(function(item) {
- city.push(item.n);
- });
- areaChildren.forEach(function(item) {
- area.push(item.n);
- });
- this.multiArray = [province, city, area]
- }
- },
- bindRegionChange(e,index) {
- let multiIndex = this.multiIndex,
- province = this.district[multiIndex[0]] || {
- c: []
- },
- city = province.c[multiIndex[1]] || {
- v: 0
- },
- multiArray = this.multiArray,
- value = e.detail.value;
-
- this.region = [multiArray[0][value[0]], multiArray[1][value[1]], multiArray[2][value[2]]]
- this.list[index].value = city.v;
- this.valueRegion = [0, 0, 0]
- this.initialize();
- },
- bindMultiPickerColumnChange(e) {
- let that = this,
- column = e.detail.column,
- value = e.detail.value,
- currentCity = this.district[value] || {
- c: []
- },
- multiArray = that.multiArray,
- multiIndex = that.multiIndex;
- multiIndex[column] = value;
- switch (column) {
- case 0:
- let areaList = currentCity.c[0] || {
- c: []
- };
- multiArray[1] = currentCity.c.map((item) => {
- return item.n;
- });
- multiArray[2] = areaList.c.map((item) => {
- return item.n;
- });
- break;
- case 1:
- let cityList = that.district[multiIndex[0]].c[multiIndex[1]].c || [];
- multiArray[2] = cityList.map((item) => {
- return item.n;
- });
- break;
- case 2:
- break;
- }
-
- this.$set(this.multiArray, 0, multiArray[0]);
- this.$set(this.multiArray, 1, multiArray[1]);
- this.$set(this.multiArray, 2, multiArray[2]);
-
-
- this.multiArray = multiArray;
-
- this.multiIndex = multiIndex
- },
- radioChange(e, index){
- this.list[index].value = e.detail.value
- },
- bindDateChange: function(e, index) {
- this.list[index].value = e.target.value
- },
- getInfo(){
- levelInfo().then(res=>{
- res.data.forEach(item=>{
- if(item.format == 'radio'){
- item.value = '0'
- }else{
- item.value = ''
- }
- })
- this.list = res.data;
- }).catch(err=>{
- this.$util.Tips({
- title: err
- })
- })
- }
- },
- onReachBottom() {
- }
- }
- </script>
- <style lang="scss">
- .gradeActive{
- padding-bottom: 20rpx;
- .headerBg{
- width: 100%;
- height: 264rpx;
- background: linear-gradient(58deg, #FDC683 0%, #FFDAB6 100%);
- border-radius: 0 0 100rpx 100rpx;
- }
- .header{
- background-repeat:no-repeat;
- background-size: 100% 100%;
- width: 690rpx;
- height: 288rpx;
- margin: -236rpx auto 0 auto;
- font-weight: 400;
- color: #EDCAAC;
- font-size: 24rpx;
- padding: 78rpx 48rpx;
- .title{
- font-size: 48rpx;
- font-weight: 600;
- background: linear-gradient(180deg, #FFEFE1 0%, #FFD0A8 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- margin-bottom: 25rpx;
- }
- }
- .bnt{
- width: 690rpx;
- height: 88rpx;
- background: linear-gradient(90deg, #FFAE49 0%, #FCC887 100%);
- border-radius: 44rpx;
- font-weight: 500;
- color: #FFFFFF;
- font-size: 30rpx;
- margin: 24rpx auto 0 auto;
- text-align: center;
- line-height: 88rpx;
- }
- .conter{
- background-color: #fff;
- border-radius: 14rpx;
- margin: 26rpx auto 0 auto;
- width: 690rpx;
- padding: 44rpx 48rpx 64rpx 48rpx;
- .list{
- margin-top: 78rpx;
- padding-bottom: 28rpx;
- position: relative;
- .vipBg{
- width: 262rpx;
- height: 174rpx;
- display: block;
- position: absolute;
- right: -48rpx;
- bottom: -64rpx;
- }
- .itemNo{
- font-weight: 400;
- color: #282828;
- font-size: 26rpx;
- position: relative;
- z-index: 1;
- .pictrue{
- width: 90rpx;
- height: 90rpx;
- margin-bottom: 12rpx;
- image{
- width: 100%;
- height: 100%;
- border-radius: 50%;
- }
- }
- }
- }
- .item{
- font-size: 24rpx;
- color: #666;
- height: 156rpx;
- border-bottom: 1px solid #F5F5F5;
- padding-top: 40rpx;
- /deep/uni-radio{
- vertical-align: bottom;
- margin-right: 10rpx;
- }
- /deep/uni-radio .uni-radio-input{
- width: 28rpx;
- height: 28rpx;
- border: 1px solid #E6993A;
- }
- /deep/uni-radio .uni-radio-input.uni-radio-input-checked{
- border: 1px solid #E6993A !important;
- background-color: #E6993A !important;
- }
- /deep/.wx-radio-input {
- width: 28rpx;
- height: 28rpx;
- border: 1px solid #E6993A;
- }
- /deep/.wx-radio-input.wx-radio-input-checked {
- border: 1px solid #E6993A !important;
- background-color: #E6993A !important;
- }
- /deep/uni-radio .uni-radio-input.uni-radio-input-checked:before{
- font-size: 24rpx;
- }
- .label{
- margin-right: 80rpx;
- }
- .name{
- position: relative;
- margin-left: 17rpx;
- .asterisk{
- color: #E93323;
- position: absolute;
- color:red;
- left:-15rpx
- }
- }
- .placeholder{
- font-size: 28rpx;
- font-weight: 400;
- color: #CCCCCC;
- }
- .input{
- margin-top: 24rpx;
- padding: 0 30rpx;
- .iconfont{
- font-size: 24rpx;
- color: #999;
- }
- input{
- font-size: 28rpx;
- }
- }
- }
- .headerT{
- font-size: 30rpx;
- color: #CC803B;
- .name{
- margin: 0 40rpx;
- }
- .pictrue{
- width: 124rpx;
- height: 22rpx;
- image{
- width: 100%;
- height: 100%;
- display: block;
- }
- &.on{
- transform: rotateX(180deg);
- }
- }
- }
- }
- }
- </style>
|