小程序开发说明
开发语言:Java
框架:ssm
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql 5.7(一定要5.7版本)
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器
小程序框架:uniapp
小程序开发软件:HBuilder X
小程序运行软件:微信开发者
数据库:
DROP TABLE IF EXISTS `address`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `address` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘主键’,
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间’,
`userid` bigint(20) NOT NULL COMMENT ‘用户id’,
`address` varchar(200) NOT NULL COMMENT ‘地址’,
`name` varchar(200) NOT NULL COMMENT ‘收货人’,
`phone` varchar(200) NOT NULL COMMENT ‘电话’,
`isdefault` varchar(200) NOT NULL COMMENT ‘是否默认地址[是/否]’,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1647526986518 DEFAULT CHARSET=utf8 COMMENT=’地址’;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Dumping data for table `address`
—
LOCK TABLES `address` WRITE;
/*!40000 ALTER TABLE `address` DISABLE KEYS */;
INSERT INTO `address` VALUES (1,’2022-03-17 14:18:36′,11,’宇宙银河系金星1号’,’金某’,’13823888881′,’是’),(2,’2022-03-17 14:18:36′,12,’宇宙银河系木星1号’,’木某’,’13823888882′,’是’),(3,’2022-03-17 14:18:36′,13,’宇宙银河系水星1号’,’水某’,’13823888883′,’是’),(4,’2022-03-17 14:18:36′,14,’宇宙银河系火星1号’,’火某’,’13823888884′,’是’),(5,’2022-03-17 14:18:36′,15,’宇宙银河系土星1号’,’土某’,’13823888885′,’是’),(6,’2022-03-17 14:18:36′,16,’宇宙银河系月球1号’,’月某’,’13823888886′,’是’),(1647526986517,’2022-03-17 14:23:05′,1647526949400,’广东省’,’小小’,’13613613666′,’否’);
/*!40000 ALTER TABLE `address` ENABLE KEYS */;
UNLOCK TABLES;
—
— Table structure for table `cart`
—
DROP TABLE IF EXISTS `cart`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cart` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘主键’,
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间’,
`tablename` varchar(200) DEFAULT ‘chanpinxinxi’ COMMENT ‘商品表名’,
`userid` bigint(20) NOT NULL COMMENT ‘用户id’,
`goodid` bigint(20) NOT NULL COMMENT ‘商品id’,
`goodname` varchar(200) DEFAULT NULL COMMENT ‘商品名称’,
`picture` varchar(200) DEFAULT NULL COMMENT ‘图片’,
`buynumber` int(11) NOT NULL COMMENT ‘购买数量’,
`price` float DEFAULT NULL COMMENT ‘单价’,
`discountprice` float DEFAULT NULL COMMENT ‘会员价’,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1647526971517 DEFAULT CHARSET=utf8 COMMENT=’购物车表’;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Dumping data for table `cart`
—
LOCK TABLES `cart` WRITE;
/*!40000 ALTER TABLE `cart` DISABLE KEYS */;
/*!40000 ALTER TABLE `cart` ENABLE KEYS */;
UNLOCK TABLES;
—
— Table structure for table `chanpinfenlei`
—
DROP TABLE IF EXISTS `chanpinfenlei`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `chanpinfenlei` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘主键’,
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间’,
`chanpinfenlei` varchar(200) NOT NULL COMMENT ‘产品分类’,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1647526872417 DEFAULT CHARSET=utf8 COMMENT=’产品分类’;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Dumping data for table `chanpinfenlei`
—
LOCK TABLES `chanpinfenlei` WRITE;
/*!40000 ALTER TABLE `chanpinfenlei` DISABLE KEYS */;
INSERT INTO `chanpinfenlei` VALUES (51,’2022-03-17 14:18:36′,’产品分类1′),(52,’2022-03-17 14:18:36′,’产品分类2′),(53,’2022-03-17 14:18:36′,’产品分类3′),(54,’2022-03-17 14:18:36′,’产品分类4′),(55,’2022-03-17 14:18:36′,’产品分类5′),(56,’2022-03-17 14:18:36′,’产品分类6′),(1647526872416,’2022-03-17 14:21:12′,’111′);
/*!40000 ALTER TABLE `chanpinfenlei` ENABLE KEYS */;
UNLOCK TABLES;
—
— Table structure for table `chanpinfuwu`
—
DROP TABLE IF EXISTS `chanpinfuwu`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `chanpinfuwu` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘主键’,
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间’,
`fuwubianhao` varchar(200) DEFAULT NULL COMMENT ‘服务编号’,
`fuwumingcheng` varchar(200) DEFAULT NULL COMMENT ‘服务名称’,
`fuwuleixing` varchar(200) DEFAULT NULL COMMENT ‘服务类型’,
`tupian` varchar(200) DEFAULT NULL COMMENT ‘图片’,
`fuwuneirong` longtext COMMENT ‘服务内容’,
`fuwujieshao` longtext COMMENT ‘服务介绍’,
PRIMARY KEY (`id`),
UNIQUE KEY `fuwubianhao` (`fuwubianhao`)
) ENGINE=InnoDB AUTO_INCREMENT=1647526859650 DEFAULT CHARSET=utf8 COMMENT=’产品服务’;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Dumping data for table `chanpinfuwu`
—
LOCK TABLES `chanpinfuwu` WRITE;
/*!40000 ALTER TABLE `chanpinfuwu` DISABLE KEYS */;
INSERT INTO `chanpinfuwu` VALUES (31,’2022-03-17 14:18:36′,’1111111111′,’服务名称1′,’服务类型1′,’upload/chanpinfuwu_tupian1.jpg’,’服务内容1′,’服务介绍1′),(32,’2022-03-17 14:18:36′,’2222222222′,’服务名称2′,’服务类型2′,’upload/chanpinfuwu_tupian2.jpg’,’服务内容2′,’服务介绍2′),(33,’2022-03-17 14:18:36′,’3333333333′,’服务名称3′,’服务类型3′,’upload/chanpinfuwu_tupian3.jpg’,’服务内容3′,’服务介绍3′),(34,’2022-03-17 14:18:36′,’4444444444′,’服务名称4′,’服务类型4′,’upload/chanpinfuwu_tupian4.jpg’,’服务内容4′,’服务介绍4′),(35,’2022-03-17 14:18:36′,’5555555555′,’服务名称5′,’服务类型5′,’upload/chanpinfuwu_tupian5.jpg’,’服务内容5′,’服务介绍5′),(36,’2022-03-17 14:18:36′,’6666666666′,’服务名称6′,’服务类型6′,’upload/chanpinfuwu_tupian6.jpg’,’服务内容6′,’服务介绍6′),(1647526859649,’2022-03-17 14:20:59′,’1647526796396′,’护肤’,’洗脸’,’upload/1647526847319.jpg’,’健美容产品所取代乃是化妆品的大势所趋。二十世纪的化妆品市场将会是生物技术和基因技术的天下。美容化妆品市场在经历了矿物质,羊脂油,纯植物,化工合成品这四代的演化发展…’,'<p><span style=\”background-color: rgb(255, 255, 255); color: rgb(51, 51, 51);\”>健</span><span style=\”background-color: rgb(255, 255, 255); color: rgb(247, 49, 49);\”>美容产品</span><span style=\”background-color: rgb(255, 255, 255); color: rgb(51, 51, 51);\”>所取代乃是化妆品的大势所趋。二十世纪的化妆品市场将会是生物技术和基因技术的天下。美容化妆品市场在经历了矿物质,羊脂油,纯植物,化工合成品这四代的演化发展…</span></p>’);
/*!40000 ALTER TABLE `chanpinfuwu` ENABLE KEYS */;
UNLOCK TABLES;
代码:
export default {
data() {
return {
btnColor: [‘#409eff’,’#67c23a’,’#909399′,’#e6a23c’,’#f56c6c’,’#356c6c’,’#351c6c’,’#f093a9′,’#a7c23a’,’#104eff’,’#10441f’,’#a21233′,’#503319′],
queryList:[
{
queryName:”服务名称”,
},
],
sactiveItem: {“padding”:”0 28rpx”,”boxShadow”:”0 0 0px rgba(0,0,0,.3)”,”margin”:”0″,”borderColor”:”rgba(255, 255, 255, 1)”,”backgroundColor”:”rgba(124, 194, 247, 1)”,”color”:”#fff”,”borderRadius”:”0″,”borderWidth”:”2rpx 0″,”width”:”160rpx”,”lineHeight”:”80rpx”,”fontSize”:”28rpx”,”borderStyle”:”solid”},
sitem: {“padding”:”0 20rpx”,”boxShadow”:”0 0 0px rgba(0,0,0,.3)”,”margin”:”0″,”borderColor”:”rgba(255, 255, 255, 1)”,”backgroundColor”:”rgba(82, 142, 187, 1)”,”color”:”rgba(255, 255, 255, 1)”,”borderRadius”:”0″,”borderWidth”:”2rpx 0″,”width”:”160rpx”,”lineHeight”:”80rpx”,”fontSize”:”28rpx”,”borderStyle”:”solid”},
queryIndex: 0,
list: [],
userid: ”,
mescroll: null, //mescroll实例对象
downOption: {
auto: false //是否在初始化后,自动执行下拉回调callback; 默认true
},
upOption: {
noMoreSize: 5, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
textNoMore: ‘~ 没有更多了 ~’,
},
hasNext: true,
searchForm:{},
CustomBar: ‘0’
};
},
computed: {
baseUrl() {
return this.$base.url;
}
},
async onShow() {
this.btnColor = this.btnColor.sort(()=> {
return (0.5-Math.random());
});
this.hasNext = true
// 重新加载数据
if (this.mescroll) this.mescroll.resetUpScroll()
},
onLoad(options) {
if(options.userid) {
this.userid=options.userid;
} else {
this.userid = “”;
}
this.hasNext = true
// 重新加载数据
if (this.mescroll) this.mescroll.resetUpScroll()
},
methods: {
//查询条件切换
queryChange(e) {
this.queryIndex=e.detail.value;
this.searchForm.fuwumingcheng=””;
},
//类别搜索
// mescroll组件初始化的回调,可获取到mescroll对象
mescrollInit(mescroll) {
this.mescroll = mescroll;
},
/*下拉刷新的回调 */
downCallback(mescroll) {
this.hasNext = true
// 重置分页参数页数为1
mescroll.resetUpScroll()
},
/*上拉加载的回调: mescroll携带page的参数, 其中num:当前页 从1开始, size:每页数据条数,默认10 */
async upCallback(mescroll) {
let params = {
page: mescroll.num,
limit: mescroll.size
}
if(this.searchForm.fuwumingcheng){
params[‘fuwumingcheng’] = ‘%’ + this.searchForm.fuwumingcheng + ‘%’
}
let res = {}
if(this.userid) {
res = await this.$api.page(`yuyuexinxi`, params);
} else {
res = await this.$api.list(`yuyuexinxi`, params);
}
// 如果是第一页数据置空
if (mescroll.num == 1) this.list = [];
this.list = this.list.concat(res.data.list);
if (res.data.list.length == 0) this.hasNext = false;
mescroll.endSuccess(mescroll.size, this.hasNext);
},
// 详情
onDetailTap(item) {
uni.setStorageSync(“useridTag”,this.userid);
this.$utils.jump(`./detail?id=${item.id}&userid=`+this.userid)
},
// 修改
onUpdateTap(id){
uni.setStorageSync(“useridTag”,this.userid);
this.$utils.jump(`./add-or-update?id=${id}`)
},
// 添加
onAddTap(){
uni.setStorageSync(“useridTag”,this.userid);
this.$utils.jump(`./add-or-update`)
},
onDeleteTap(id){
var _this = this;
uni.showModal({
title: ‘提示’,
content: ‘是否确认删除’,
success: async function(res) {
if (res.confirm) {
await _this.$api.del(‘yuyuexinxi’, JSON.stringify([id]));
_this.hasNext = true
// 重置分页参数页数为1
_this.mescroll.resetUpScroll()
}
}
});
},
// 搜索
async search(){
this.mescroll.num = 1
let searchForm = {
page: this.mescroll.num,
limit: this.mescroll.size
}
if(this.searchForm.fuwumingcheng){
searchForm[‘fuwumingcheng’] = ‘%’ + this.searchForm.fuwumingcheng + ‘%’
}
let res = {};
if(this.userid) {
res = await this.$api.page(`yuyuexinxi`, searchForm);
} else {
res = await this.$api.list(`yuyuexinxi`, searchForm);
}
// 如果是第一页数据置空
if (this.mescroll.num == 1) this.list = [];
this.list = this.list.concat(res.data.list);
if (res.data.list.length == 0) this.hasNext = false;
this.mescroll.endSuccess(this.mescroll.size, this.hasNext);
}
}
};