会员接口对接

This commit is contained in:
77 2024-10-21 19:28:07 +08:00
parent 7c755a2171
commit deee0ca751
2 changed files with 27 additions and 16 deletions

View File

@ -54,12 +54,13 @@
<view class="vip-kt">
<view class="top">
<text class="t1">开通会员</text>
<text class="t1" v-if="userInfo.activate == 1">试用会员</text>
<text class="t1" v-if="userInfo.activate == 2">开通会员</text>
<text class="t2">有效期至</text>
<text class="t3">2024-10-24</text>
</view>
<scroll-view class="scroll-view_H" scroll-x="true" @scroll="scroll" scroll-left="120">
<view id="demo1" @click="vipFun(index)" class="scroll-view-item_H uni-bg-red" :class="valVip == index ? 'on' : ''" v-for="(item,index) in vipList" :key="index">
<view id="demo1" @click="vipFun(index,item.name)" class="scroll-view-item_H uni-bg-red" :class="valVip == index ? 'on' : ''" v-for="(item,index) in vipList" :key="index">
<view class="t">{{item.name}}</view>
<view class="c"><text class="tx">{{item.specialPrice}}</text></view>
<view class="b" v-if="index==0">试用1天</view>
@ -71,9 +72,12 @@
<view class="vip-text">
购买即视为同意<text class="ts">会员用户协议</text>
</view>
<view class="vip-btn" @click="beclick()">
<view class="vip-btn" @click="beclick()" v-if="userInfo.activate != 1">
立即试用
</view>
<view class="vip-btn" @click="beclick()" v-else>
立即开通
</view>
</view>
</s-layout>
</template>
@ -96,6 +100,7 @@
const vipList = ref([]);
const vipList2 = ref([]);
const valVip = ref([]);
const nameVip = ref([]);
//
function getList() {
request({
@ -113,27 +118,28 @@
}
// vipFun
function vipFun(index) {
valVip.value = index
let data = {
cardName:nameVip.value
}
function vipFun(index,name) {
valVip.value = index
data.cardName = name
}
let kk = {
cardName:'试用'
};
// beclick
function beclick() {
console.log(data.cardName,"nameVip.value")
request({
url: `${baseUrl}${apiPath}/pay/member/create`,
method: 'post',
params: {
cardName:kk
},
data,
custom: {
showLoading: false,
},
}).then((res) => {
console.log(JSON.stringify(kk),"-----------试用---------------")
console.log(res,"-----------试用---------------")
sheep.$helper.toast('试用开通成功');
sheep.$router.go('/pages/index/user')
});
}

View File

@ -68,7 +68,10 @@
<view v-if="type === 'UserOrder'" class="new-huiy" @click="
sheep.$router.go('/pages/user/user_vip/list')
">
<view class="new-button">立即开通</view>
<view class="new-button" v-if="userInfo.activate == 1">正在试用</view>
<view class="new-button" v-if="userInfo.activate == 2">开通</view>
<view class="new-button" v-if="userInfo.activate == 3">永久</view>
<view class="new-button" v-if="userInfo.activate == 0">立即开通</view>
<image class="seckill1" mode="aspectFit"
src="https://zysc.fjptzykj.com:3000/shangcheng/64776e2edc3c2f15295e7c3976ba301e08f9170f99a2e845d8f33bd65179b177.png" />
</view>
@ -86,13 +89,15 @@
import {
ref,
reactive,
unref
unref,
computed
} from 'vue';
import AddressApi from '@/sheep/api/member/address';
const state = reactive({
model: [],
});
//
const userInfo = computed(() => sheep.$store('user').userInfo);
const ff = async (id) => {
let {
code,