diff --git a/components/badge/index.js b/components/badge/index.js
index 7be4e1f..8eb21dc 100644
--- a/components/badge/index.js
+++ b/components/badge/index.js
@@ -9,7 +9,7 @@ Component({
type: Boolean,
require: false
},
- item: {
+ info: {
type: Object,
require: true
},
diff --git a/components/badge/index.wxml b/components/badge/index.wxml
index 7dcfb36..4ee40fc 100644
--- a/components/badge/index.wxml
+++ b/components/badge/index.wxml
@@ -5,13 +5,13 @@
-
+
- 新手园丁
- 徽章获取条件:2025年12月15日,添加第一颗植物
-
+ {{info.name}}
+ 徽章获取条件:{{info.desc}}
+
\ No newline at end of file
diff --git a/pages/about/index.js b/pages/about/index.js
index 1c6bd5b..716cc59 100644
--- a/pages/about/index.js
+++ b/pages/about/index.js
@@ -1,3 +1,5 @@
+const { api } = require("../../utils/api")
+
// pages/about/index.js
Page({
@@ -12,19 +14,10 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
- if (options.type !=undefined){
- wx.showToast({
- title: '获取成功',
- icon: 'success'
- })
- }
+
},
- goHome(){
- wx.switchTab({
- url: '../index/index',
- })
- },
+
/**
* 生命周期函数--监听页面初次渲染完成
diff --git a/pages/add/index.js b/pages/add/index.js
index 5f55ce0..37bac1c 100644
--- a/pages/add/index.js
+++ b/pages/add/index.js
@@ -64,7 +64,8 @@ Page({
"icon":"broccoli"
}
]
- }
+ },
+ badge:null
},
/**
@@ -159,7 +160,11 @@ Page({
})
api('/plant/add','POST',this.data.form,'json').then(res => {
if (res.code === 200){
- this.setData({show:true})
+ const tmps = res.data
+ if (tmps != null){
+ this.setData({badge: tmps[0],show:true})
+ }
+
} else {
wx.showModal({
content: res.msg
diff --git a/pages/add/index.wxml b/pages/add/index.wxml
index c15005b..07d8ff1 100644
--- a/pages/add/index.wxml
+++ b/pages/add/index.wxml
@@ -51,7 +51,7 @@
-
+
\ No newline at end of file
diff --git a/pages/order/index.js b/pages/order/index.js
index c6f94bc..115a45a 100644
--- a/pages/order/index.js
+++ b/pages/order/index.js
@@ -11,7 +11,7 @@ Page({
id: '',
info: null,
addr: null,
- checked:false
+ checked: false
},
/**
@@ -27,10 +27,12 @@ Page({
api('/personal/address/list', 'GET').then(res => {
if (res.code === 200) {
const tmps = res.data
- if(tmps.length > 0){
- this.setData({addr:tmps[0]})
+ if (tmps.length > 0) {
+ this.setData({
+ addr: tmps[0]
+ })
}
-
+
}
})
},
@@ -39,15 +41,20 @@ Page({
const _this = this
wx.chooseAddress({
success(res) {
- const data = {isDefault:1,phone:res.telNumber, name :res.userName,detail: res.provinceName + res.cityName + res.countyName + res.detailInfo}
+ const data = {
+ isDefault: 1,
+ phone: res.telNumber,
+ name: res.userName,
+ detail: res.provinceName + res.cityName + res.countyName + res.detailInfo
+ }
_this.saveAddr(data)
}
})
},
- saveAddr(data){
- api('/personal/address/add','POST',data,'json').then(res => {
- if (res.code=== 200) {
+ saveAddr(data) {
+ api('/personal/address/add', 'POST', data, 'json').then(res => {
+ if (res.code === 200) {
this.fetchAddr()
}
})
@@ -68,22 +75,63 @@ Page({
this.fetchAddr()
},
- change(){
+ change() {
const checked = !this.data.checked
- this.setData({checked:checked})
+ this.setData({
+ checked: checked
+ })
},
- pay(){
- if (this.data.checked === false){
+ pay() {
+ if (this.data.checked === false) {
wx.showModal({
content: '请先勾选,我承诺会好好照顾它,不随意丢弃。',
- complete: (res) => {
- if (res.confirm) {
-
- }
- }
})
+ return
}
+ const data = {
+ addressId: this.data.addr.id,
+ id: this.data.id
+ }
+ wx.showLoading({
+ title: '请稍后',
+ })
+ api('/claim/claim', 'GET', data).then(res => {
+ if (res.code === 200) {
+ const orderId = res.data
+ api('/pay/prePay', 'GET', {
+ orderId: orderId
+ }).then(res => {
+ wx.hideLoading()
+ if (res.code === 200) {
+ const pay = res.data
+ wx.requestPayment({
+ appId: "wxb463820bf36dd5d6",
+ nonceStr: pay.nonceStr,
+ package: pay.package,
+ signType: pay.signType,
+ paySign: pay.paySign,
+ timeStamp: pay.timeStamp,
+ "success": res => {
+ // 检查支付
+ console.log(res);
+ },
+ "fail": function (res) {
+ console.log(res);
+ },
+ "complete": function (res) {
+ console.log(res);
+ }
+ })
+
+ }
+ })
+ } else {
+ wx.showModal({
+ content: res.msg,
+ })
+ }
+ })
},
fetchInfo() {
diff --git a/pages/user/about.js b/pages/user/about.js
index 07ed452..4849366 100644
--- a/pages/user/about.js
+++ b/pages/user/about.js
@@ -1,20 +1,33 @@
// pages/user/about.js
+const {
+ api
+} = require("../../utils/api")
Page({
/**
* 页面的初始数据
*/
data: {
-
+ info:null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
-
+ this.fetchList()
},
+ fetchList(){
+ api('/config/qrcode/list','POST').then(res => {
+ if (res.code === 200){
+ const tmps = res.data
+ if (tmps.length > 0){
+ this.setData({info:tmps[0]})
+ }
+ }
+ })
+ },
/**
* 生命周期函数--监听页面初次渲染完成
*/
diff --git a/pages/user/about.wxml b/pages/user/about.wxml
index d115663..62e40fa 100644
--- a/pages/user/about.wxml
+++ b/pages/user/about.wxml
@@ -1,7 +1,7 @@
-
+
长按二维码,加入群聊
一起交流种植小技巧
diff --git a/pages/user/index.js b/pages/user/index.js
index 6bf3781..a985f14 100644
--- a/pages/user/index.js
+++ b/pages/user/index.js
@@ -11,7 +11,8 @@ Page({
data: {
user: null,
info: null,
- inviteCode: ''
+ inviteCode: '',
+ badgeList:[]
},
/**
@@ -52,6 +53,13 @@ Page({
})
}
})
+
+ api('/badge/my/list','POST',{current:0, pageSize:999},'json').then(res => {
+ if (res.code === 200) {
+ const tmps = res.data.list
+ this.setData({badgeList:tmps})
+ }
+ })
},
onChooseAvatar(e) {
diff --git a/pages/user/index.json b/pages/user/index.json
index ced5b27..0c86c88 100644
--- a/pages/user/index.json
+++ b/pages/user/index.json
@@ -1,4 +1,7 @@
{
"navigationStyle": "custom",
- "usingComponents": {}
+ "usingComponents": {
+ "t-avatar": "tdesign-miniprogram/avatar/avatar",
+ "t-avatar-group": "tdesign-miniprogram/avatar-group/avatar-group"
+ }
}
\ No newline at end of file
diff --git a/pages/user/index.wxml b/pages/user/index.wxml
index ff868db..076426a 100644
--- a/pages/user/index.wxml
+++ b/pages/user/index.wxml
@@ -18,9 +18,11 @@
- 我的徽章 已解锁 23 个
-
- 🎖️🎖️🎖️🎖️🎖️🎖️🎖️
+ 我的徽章 已解锁 {{badgeList.length}} 个
+
+
+
+
@@ -85,9 +87,9 @@
-
+
-
+