前端uniapp的tab选项卡for循环切换、开通VIP实战案例【带源码/最新】

目录

    • 效果图
      • 图1
      • 图2
    • 源码
    • 最后

这个案例是uniapp,同样也适用Vue项目,语法一样for循环,点击切换

效果图

图1

在这里插入图片描述

图2

在这里插入图片描述

源码

直接代码复制查看效果

<template><view class="my-helper-service-pass"><view class="tab-service-box"><view class="new-tab-item" @click="getTabIndex(index,item.supplier_grade_id)" v-for="(item,index) in grade_list"  :class="{ active: currentTab === index }" ><view class="bottomline"><text class="bottomline-txt1">{{item.name}}</text><view class="bottomline-txt2"><text>{{item.upgrade_money}}</text></view><text class="bottomline-txt3">免{{item.reduce_commission}}元手续费</text><text class="bottomline-txt4">送{{item.message_num}}条商机提醒</text></view></view></view><view class="submit-service-box"><view class="submit-service-btn d-c-c" @click="submitServie">确认开通并支付¥{{upgrade_money}}</view></view><view class="agreement-box"><view class="agreement" @click="isRead=!isRead"><view :class="isRead?'active agreement-new':'agreement-new'"></view>同意万事直帮<text @click="xieyi('service')">《服务通服务协议》</text></view></view><!-- 尊享8大服务权益 --><view class="equity-box"><view class="equity-tit"><view class="equity-tit-lft"></view><view class="equity-tit-txt">尊享8大服务权益</view><view class="equity-tit-rgt"></view></view><view class="equity-list"><view class="equity-list-item"><!-- <image src="https://bk-css-image.oss-cn-beijing.aliyuncs.com/static/user/index_service/my_helper_service_pass/servicepass1.png" mode=""></image> --><text class="equity-list-item1">可以发布</text><text class="equity-list-item1">{{release_num}}个服务</text></view><view class="equity-list-item"><!-- <image src="https://bk-css-image.oss-cn-beijing.aliyuncs.com/static/user/index_service/my_helper_service_pass/servicepass2.png" mode=""></image> --><text class="equity-list-item1">优质万事直帮</text><text class="equity-list-item1">服务标识</text></view><view class="equity-list-item"><!-- <image src="https://bk-css-image.oss-cn-beijing.aliyuncs.com/static/user/index_service/my_helper_service_pass/servicepass3.png" mode=""></image> --><text class="equity-list-item1">提现</text><text class="equity-list-item1">T+0到账</text></view></view><view class="equity-list equity-list2"><view class="equity-list-item"><!-- <image src="https://bk-css-image.oss-cn-beijing.aliyuncs.com/static/user/index_service/my_helper_service_pass/servicepass4.png" mode=""></image> --><text class="equity-list-item1">服务项目排名</text><text class="equity-list-item1">优先展示</text></view><view class="equity-list-item"><!-- <image src="https://bk-css-image.oss-cn-beijing.aliyuncs.com/static/user/index_service/my_helper_service_pass/servicepass5.png" mode=""></image> --><text class="equity-list-item1">减免{{reduce_commission}}元的</text><text class="equity-list-item1">订单手续费</text></view><view class="equity-list-item"><!-- <image src="https://bk-css-image.oss-cn-beijing.aliyuncs.com/static/user/index_service/my_helper_service_pass/servicepass6.png" mode=""></image> --><text class="equity-list-item1">导师在线指导</text><text class="equity-list-item1">接单赚钱</text></view></view><view class="equity-list equity-list2"><view class="equity-list-item"><!-- <image src="https://bk-css-image.oss-cn-beijing.aliyuncs.com/static/user/index_service/my_helper_service_pass/servicepass7.png" mode=""></image> --><text class="equity-list-item1">享受平台站内和</text><text class="equity-list-item1">站外流量扶持</text></view><view class="equity-list-item"><!-- <image src="https://bk-css-image.oss-cn-beijing.aliyuncs.com/static/user/index_service/my_helper_service_pass/servicepass8.png" mode=""></image> --><text class="equity-list-item1">赠送{{message_num}}条短信</text><text class="equity-list-item1">服务商机提醒,包含对话和订单提醒</text></view></view></view><view class="block-btm"></view></view>
</template><script>export default {data() {return {currentTab: 0,removeobstaclesfrom: '', //开通需要传的参数isRead: false,// grade_list: [],supplier_grade_id: '',payPrice:'',//支付的钱数service_vip_url:'',upgrade_money:'',release_num:'',reduce_commission:'',message_num:'',grade_list:[]}},mounted() {this.getVipListData();},methods: {// VIP列表getVipListData() {let self = this;self.isloadding = true;self._get('supplier.grade/gradeList', {}, function(res) {// 实际接口返回的现在用,测试的,暂且注释,用下面第二个数据赋值// 第一个赋值// self.grade_list = res.data.grade_list;// 接口返回的数据,复制过来的let getList = [{"supplier_grade_id": 3,"name": "1个月","upgrade_money": 188,"is_default": 0,"weight": 110,"reduce_commission": 188,"release_num": 6,"message_num": 188,"time": 30,"is_delete": 0,"app_id": 10001,"create_time": "2023-09-28 13:50:54","update_time": "2023-12-29 10:25:38"},{"supplier_grade_id": 4,"name": "3个月","upgrade_money": 388,"is_default": 0,"weight": 120,"reduce_commission": 388,"release_num": 10,"message_num": 388,"time": 90,"is_delete": 0,"app_id": 10001,"create_time": "2023-10-19 15:55:03","update_time": "2023-12-29 10:25:45"},{"supplier_grade_id": 5,"name": "12个月","upgrade_money": 688,"is_default": 0,"weight": 127,"reduce_commission": 688,"release_num": 18,"message_num": 700,"time": 365,"is_delete": 0,"app_id": 10001,"create_time": "2023-12-13 09:57:32","update_time": "2023-12-29 10:37:04"}]// 第二个赋值self.grade_list = getList;// 接口赋值// self.supplier_grade_id = res.data.grade_list[0].supplier_grade_id// self.upgrade_money = res.data.grade_list[0].upgrade_money// console.log(res.data.grade_list[0].release_num,'发布数量');// console.log(res.data.grade_list[0].reduce_commission,'发布数量');// console.log(res.data.grade_list[0].message_num,'发布数量');// self.release_num = res.data.grade_list[0].release_num;// self.reduce_commission = res.data.grade_list[0].reduce_commission;// self.message_num = res.data.grade_list[0].message_num;// self.service_vip_url = res.data.service_vip_url// 模拟复制过来的接口数据赋值self.supplier_grade_id = rgetList[0].supplier_grade_idself.upgrade_money = getList[0].upgrade_moneyconsole.log(getList[0].release_num,'发布数量');console.log(getList[0].reduce_commission,'发布数量');console.log(getList[0].message_num,'发布数量');self.release_num = getList[0].release_num;self.reduce_commission = rgetList[0].reduce_commission;self.message_num = getList[0].message_num;// self.service_vip_url = res.data.service_vip_url});},getTabIndex(index,supplier_grade_id){this.currentTab = index;this.upgrade_money = this.grade_list[index].upgrade_money;this.release_num = this.grade_list[index].release_num;this.reduce_commission = this.grade_list[index].reduce_commission;this.message_num = this.grade_list[index].message_num;this.supplier_grade_id = supplier_grade_id;},xieyi() {// let url = '';// if (type == 'service') {// 	url = this.service;// } else {// 	url = this.privacy;// }let url = this.service_vip_url;uni.navigateTo({url: '/subPages/webview/webview?url=' + url});},submitServie() {let self = this;if (!self.isRead) {uni.showToast({title: '请同意并勾选协议内容',duration: 2000,icon: 'none'});return;}wx.showModal({title: '提示',content: '您确认开通吗?',success: function(o) {if (o.confirm) {uni.showLoading({title: '正在处理'});self._post('supplier.grade/deposit', {supplier_grade_id: self.supplier_grade_id,}, function(res) {// console.log(res.data.money,'返回的余额');// console.log(res.data.order_id,'开通成功');let balance = res.data.money;//余额// let payPrice = self.payPrice;//支付的钱数let payPrice = self.upgrade_money;//支付的钱数let order_id = res.data.order_iduni.navigateTo({url:`/pagesB/user/index_service/my_helper_service_pass/cashier?order_id=${order_id}&balance=${balance}&payPrice=${payPrice}`})// console.log(balance,'传余额');// console.log(payPrice,'传支付的钱数');// console.log(order_id,'传order_id');// let order_id = res.data.order_id// uni.navigateTo({// 	url:`/pages/user/index_service/my_helper_service_pass/cashier?order_id=' + order_id// })});}}});}}}
</script><style scoped>page {/* background: linear-gradient(180deg, #1D1F21 0%, #242629 100%); */background-color: black;}.my-helper-service-pass {background-color: black;}.tab-service-box {/* margin: 26rpx 32rpx 0 32rpx; */margin: 0 32rpx 0 32rpx;padding-top: 26rpx;box-sizing: border-box;display: flex;justify-content: space-between;}/* 下面默认未选中样式 */.new-tab-item {width: 214rpx;height: 258rpx;background: linear-gradient(180deg, #FEEFD3 0%, #E2C091 100%);border-radius: 16rpx 16rpx 16rpx 16rpx;opacity: 1;border-radius: 16rpx 16rpx 16rpx 16rpx;}.new-tab-item .bottomline {display: flex;justify-content: center;flex-direction: column;align-items: center;}.bottomline-txt1 {margin-top: 22rpx;font-size: 28rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 400;color: #231F18;line-height: 52rpx;}.bottomline-txt2 {margin-top: 8rpx;font-size: 36rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 400;color: #663211;line-height: 52rpx;}.bottomline-txt2 text {font-size: 48rpx;font-weight: 700;}.bottomline-txt3 {margin-top: 8rpx;font-size: 24rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 400;color: #2B2B2B;line-height: 52rpx;}.bottomline-txt4 {font-size: 24rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 400;color: #2B2B2B;line-height: 52rpx;}/* 下面选中样式 */.tab-service-box .active {width: 214rpx;height: 258rpx;background: #1F2123;border-radius: 16rpx 16rpx 16rpx 16rpx;opacity: 1;border: 2rpx solid;border-image: linear-gradient(180deg, rgba(164.00000542402267, 104.00000140070915, 66.00000366568565, 1), rgba(226.0000017285347, 192.00000375509262, 145.00000655651093, 1)) 2 2;display: flex;flex-direction: column;border-radius: 16rpx 16rpx 16rpx 16rpx;}.tab-service-box .active .bottomline-txt1 {margin-top: 22rpx;font-size: 28rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 400;color: #FFFFFF;line-height: 52rpx;}.tab-service-box .active .bottomline-txt2 {margin-top: 8rpx;font-size: 36rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 400;color: #E2C091;line-height: 52rpx;}.tab-service-box .active .bottomline-txt2 text {font-size: 48rpx;font-weight: 700;}.tab-service-box .active .bottomline-txt3 {margin-top: 8rpx;font-size: 24rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 400;color: #FFFFFF;line-height: 52rpx;}.tab-service-box .active .bottomline-txt4 {font-size: 24rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 400;color: #FFFFFF;line-height: 52rpx;}.submit-service-box {display: flex;justify-content: center;margin-top: 60rpx;}.submit-service-btn {width: 554rpx;height: 80rpx;background: linear-gradient(180deg, #FEF0D4 0%, #E1BF8F 100%);border-radius: 60rpx 60rpx 60rpx 60rpx;opacity: 1;font-size: 28rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 700;color: #663211;line-height: 64rpx;}.agreement-box {display: flex;justify-content: center;margin-top: 16rpx;}.agreement {font-size: 24rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 400;color: #FFFFFF;line-height: 52rpx;display: flex;align-items: center;}.agreement text {font-size: 24rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 400;color: #E1BF8F;line-height: 52rpx;}.agreement-new {border-radius: 50%;width: 28rpx;height: 28rpx;border: 2rpx solid #999999;background: #fff;position: relative;margin-right: 10rpx;box-sizing: border-box;}.agreement-new.active::after {content: '';width: 16rpx;height: 16rpx;background: linear-gradient(180deg, #FEF0D4 0%, #C19D6C 100%);border-radius: 50%;position: absolute;left: 0;top: 0;right: 0;bottom: 0;margin: auto;}.equity-box {margin: 32rpx 30rpx 0 32rpx;height: 770rpx;background: linear-gradient(117deg, #323232 0%, #1B1B1B 100%);border-radius: 20rpx 20rpx 20rpx 20rpx;opacity: 1;display: flex;flex-direction: column;/* margin-bottom: 154rpx; */}.equity-tit {display: flex;align-items: center;justify-content: center;margin-top: 28rpx !important;}.equity-tit-lft {width: 40rpx;height: 4rpx;background: linear-gradient(270deg, #E1C092 0%, rgba(216, 216, 216, 0) 100%);border-radius: 72rpx 72rpx 72rpx 72rpx;opacity: 1;margin-right: 20rpx;}.equity-tit-txt {font-size: 42rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 700;color: #F4DFBA;line-height: 64rpx;}.equity-tit-rgt {width: 40rpx;height: 4rpx;background: linear-gradient(270deg, #E1C092 0%, rgba(216, 216, 216, 0) 100%);border-radius: 72rpx 72rpx 72rpx 72rpx;opacity: 1;transform: rotate(180deg);margin-left: 20rpx;}.equity-list {margin-top: 20rpx;display: flex;/* justify-content: space-between; */justify-content: space-around;/* margin-left: 60rpx;margin-right: 66rpx; */}.equity-list-item {display: flex;flex-direction: column;justify-content: center;align-items: center;}.equity-list-item image {width: 76rpx;height: 76rpx;background: #231F18;opacity: 1;border-radius: 16rpx;margin-bottom: 12rpx;}.equity-list-item1 {font-size: 28rpx;font-family: Microsoft YaHei, Microsoft YaHei;font-weight: 400;color: #FFFFFF;line-height: 40rpx;}.equity-list2 {margin-top: 48rpx;}.block-btm {height: 154rpx;}
</style>

最后

感觉文章好的话记得点个心心和关注和收藏,有错的地方麻烦指正一下,如果需要转载,请标明出处,多谢!!!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/319447.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

实时数据处理概述与Spark Streaming简介

实时数据处理已经成为当今大数据时代的一个重要领域&#xff0c;它使组织能够及时分析和采取行动&#xff0c;以应对不断变化的数据。Spark Streaming是Apache Spark生态系统中的一个模块&#xff0c;专门用于实时数据处理。本文将深入探讨实时数据处理的概念&#xff0c;并介绍…

[C#]C# OpenVINO部署yolov8图像分类模型

【官方框架地址】 https://github.com/ultralytics/ultralytics.git 【算法介绍】 YOLOv8 抛弃了前几代模型的 Anchor-Base。 YOLO 是一种基于图像全局信息进行预测的目标检测系统。自 2015 年 Joseph Redmon、Ali Farhadi 等人提出初代模型以来&#xff0c;领域内的研究者们…

LeetCode 2807. 在链表中插入最大公约数

给你一个链表的头 head &#xff0c;每个结点包含一个整数值。 在相邻结点之间&#xff0c;请你插入一个新的结点&#xff0c;结点值为这两个相邻结点值的 最大公约数 。 请你返回插入之后的链表。 两个数的 最大公约数 是可以被两个数字整除的最大正整数。 示例 1&#xf…

【亚马逊云科技】自家的AI助手 - Amazon Q

写在前面&#xff1a;博主是一只经过实战开发历练后投身培训事业的“小山猪”&#xff0c;昵称取自动画片《狮子王》中的“彭彭”&#xff0c;总是以乐观、积极的心态对待周边的事物。本人的技术路线从Java全栈工程师一路奔向大数据开发、数据挖掘领域&#xff0c;如今终有小成…

NVMe SSD IO压力导致宕机案例解读-1

近日&#xff0c;小编在内核pci模块变更提交记录里面&#xff0c;看到一条由联想工程师提交的一份变更&#xff0c;主要是针对DMA相关优化。小编根据提交内容&#xff0c;根据自己的理解分享给大家。&#xff08;原始git地址获取&#xff0c;请在后台私信输入关键字“IO宕机”&…

【模拟电路】EDA软件、绘制原理图和PCB

一、EDA软件 二、常用的PCB的EDA软件 三、PCB生产工艺制造流程 四、国产嘉立创EDA专业版使用 五、EDA软件-绘制开关电路原理图 六、原理图转PCB绘制 七、检查DRC 八、PCB下单流程 一、EDA软件 EDA是电子设计自动化&#xff08;Electronic Design Automation&#xff09;的缩写…

清风数学建模排版

Overview 链接&#xff1a;https://pan.baidu.com/s/11QBw3zBFNicwQWvWCfW1Gg?pwdepnz 提取码&#xff1a;epnz Latex 范文排版练习 b站刘海洋latex工作室&#xff0c;待还愿 Word基础 Word VBA&#xff0c;待还愿 fnF4&#xff1a;重复上一步操作 ctrlY&#xff1a;恢…

视频通话录制 方案 教程

一些基本概要 1 市面流行的音视频产品&#xff0c;都包含一对一、一对多、多对多通话&#xff0c;云端录制等这些基本功能&#xff0c;有些厂商支持本地服务录制。 2 本地服务录制&#xff0c;云端录制区别 两个录制区别在于&#xff0c;本地服务端录制的 SDK 要求部署在 …

简易机器学习笔记(八)关于经典的图像分类问题-常见经典神经网络LeNet

前言 图像分类是根据图像的语义信息对不同类别图像进行区分&#xff0c;是计算机视觉的核心&#xff0c;是物体检测、图像分割、物体跟踪、行为分析、人脸识别等其他高层次视觉任务的基础。图像分类在许多领域都有着广泛的应用&#xff0c;如&#xff1a;安防领域的人脸识别和…

对技术行业的深度思考

技术行业是当今世界最为热门和发展迅猛的领域之一。无论是互联网、人工智能还是区块链&#xff0c;技术的快速发展正在改变着我们的生活和社会。然而&#xff0c;我们是否真正思考过技术在我们生活中的影响和意义&#xff1f;本文将对技术行业展开深度思考&#xff0c;探讨其带…

LAMP平台搭建

目录 LAMP平台概述 1、Apache 网站服务基础 1.1、Apache 简介 &#xff08;1&#xff09;Apache 的起源 &#xff08;2&#xff09;Apache 的主要特点 1.2、安装 httpd 服务器 &#xff08;1&#xff09;准备工作 &#xff08;2&#xff09;源码编译及安装 &#…

【MySQL】MySQL如何查询和筛选存储的JSON数据?

MySQL如何查询和筛选存储的JSON数据&#xff1f; 一、背景介绍二、支持的JSON数据类型三、基础数据3.1 创建表3.2 插入 JSON 数据3.3 查询 JSON 数据 四、操作函数4.1 JSON_OBJECT4.2 JSON_ARRAY4.3 JSON_EXTRACT 一、背景介绍 JSON(JavaScript Object Notation)是一种轻量级的…