扫sn码跳转往生大殿界面,使用sn码获取id
This commit is contained in:
parent
a7be9da972
commit
b6bc62bd7a
|
|
@ -70,3 +70,11 @@ export function getPackageList() {
|
||||||
method: "get",
|
method: "get",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据扫码获取的sn获取id
|
||||||
|
export function getIdBySN(sn) {
|
||||||
|
return request({
|
||||||
|
url: `/app/memorial/sn/${encodeURIComponent(sn)}`, // 修复:正确拼接动态参数
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ import StatusBar from "./compositons/statusBar.vue";
|
||||||
import BottomButton from "../../components/bottom-button/bottom-button.vue";
|
import BottomButton from "../../components/bottom-button/bottom-button.vue";
|
||||||
import OfferingModal from "./compositons/offeringModal.vue";
|
import OfferingModal from "./compositons/offeringModal.vue";
|
||||||
|
|
||||||
import { getPackageList } from "../../api/memorial/memorial";
|
import { getIdBySN, getPackageList } from "../../api/memorial/memorial";
|
||||||
import { ordersEnshrined } from "../../api/order/order";
|
import { ordersEnshrined } from "../../api/order/order";
|
||||||
import { checkLogin } from "../../composables/goToLogin";
|
import { checkLogin } from "../../composables/goToLogin";
|
||||||
|
|
||||||
|
|
@ -185,14 +185,26 @@ export default {
|
||||||
PackageList: {},
|
PackageList: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
async onLoad(options) {
|
||||||
console.log("memorialHall页面接收到的参数:", options);
|
console.log("memorialHall页面接收到的参数:", options);
|
||||||
// 从路由参数获取往生殿ID
|
|
||||||
if (options.id) {
|
if (options.id) {
|
||||||
this.selectedUnitId = options.id;
|
this.selectedUnitId = options.id;
|
||||||
console.log("区域ID:", this.selectedUnitId);
|
console.log("区域ID:", this.selectedUnitId);
|
||||||
} else {
|
}
|
||||||
console.warn("未接收到区域ID,使用默认ID:", this.selectedUnitId);
|
if (options.q) {
|
||||||
|
// 步骤1:从options.q获取完整URL
|
||||||
|
const encodedQ = options.q; // "https%3A%2F%2Fwx.ccttiot.com%2Fsm%2Fd%3Fs%3D100100"
|
||||||
|
const decodedQ = decodeURIComponent(encodedQ);
|
||||||
|
// 解码后: "https://wx.ccttiot.com/sm/d?s=100100"
|
||||||
|
console.log("decodedQ", decodedQ);
|
||||||
|
// 步骤2:解析嵌套的s参数
|
||||||
|
const match = decodedQ.match(/[?&]s=([^&]*)/);
|
||||||
|
console.log("match", match); // 输出: "100100"
|
||||||
|
const sValue = match ? match[1] : null;
|
||||||
|
|
||||||
|
console.log("sValue", sValue); // 输出: "100100"
|
||||||
|
// 等待获取ID完成后再初始化页面
|
||||||
|
await this.getId(sValue);
|
||||||
}
|
}
|
||||||
this.initPage();
|
this.initPage();
|
||||||
},
|
},
|
||||||
|
|
@ -211,6 +223,7 @@ export default {
|
||||||
await this.getMemorialDetail();
|
await this.getMemorialDetail();
|
||||||
// 获取往生者列表
|
// 获取往生者列表
|
||||||
await this.getDeceasedList();
|
await this.getDeceasedList();
|
||||||
|
|
||||||
// 检查收藏状态
|
// 检查收藏状态
|
||||||
await this.checkCollectionStatus();
|
await this.checkCollectionStatus();
|
||||||
//获取订单套餐
|
//获取订单套餐
|
||||||
|
|
@ -225,6 +238,13 @@ export default {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async getId(sn) {
|
||||||
|
const response = await getIdBySN(sn);
|
||||||
|
this.selectedUnitId = response.data.id;
|
||||||
|
|
||||||
|
console.log("SN->id", this.selectedUnitId);
|
||||||
|
},
|
||||||
//获取订单套餐
|
//获取订单套餐
|
||||||
async fetchPackageList() {
|
async fetchPackageList() {
|
||||||
const response = await getPackageList();
|
const response = await getPackageList();
|
||||||
|
|
|
||||||
|
|
@ -467,7 +467,7 @@ page {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin: 10rpx 0 10rpx 0;
|
margin: 10rpx 0;
|
||||||
padding: 0 35rpx;
|
padding: 0 35rpx;
|
||||||
|
|
||||||
.search-filter-row search-box {
|
.search-filter-row search-box {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user