123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- // subpackages/orderdetails/orderdetails.js
- import { models, db, _ } from '../../utils/cloudbase.js'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- dingwei: '',
- fuzhi: '',
- yesbaoguo: '',
- item: {},
- adresseslist: {}
- },
- onLoad(options) {
- const itemData = decodeURIComponent(options.data);
- // console.log(itemData, 'itemData');
- const item = JSON.parse(itemData);
- this.setData({
- item: item
- }, () => {
- this.getadresses()
- });
- const fileIDs = [
- 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/dingwei.png',
- 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/fuzhi.png',
- 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/yesbaoguo.png'
- ];
-
- // 并发下载多个 fileID
- Promise.all(
- fileIDs.map(fileID => wx.cloud.downloadFile({ fileID }))
- ).then(results => {
- // 每个 result 对应一个下载结果
- const tempFilePaths = results.map(r => r.tempFilePath);
- console.log('全部下载成功:', tempFilePaths);
- this.setData({
- dingwei: tempFilePaths[0],
- fuzhi: tempFilePaths[1],
- yesbaoguo: tempFilePaths[2],
- });
- }).catch(err => {
- console.error('有文件下载失败:', err);
- });
- },
- async getadresses() {
- const { data } = await models.adresses.get({
- filter: {
- where: {
- $and: [
- {
- _id: {
- $eq: this.data.item.adresses_id, // 推荐传入_id数据标识进行操作
- },
- },
- ]
- }
- },
- // envType: pre 体验环境, prod 正式环境
- envType: "prod",
- });
-
- // 返回查询到的数据
- this.setData({
- adresseslist: data
- })
- },
- copyText(e) {
- const copyText = e.currentTarget.dataset.copytext;
- wx.setClipboardData({
- data: copyText,
- success: function () {
- wx.showToast({
- title: '复制成功',
- icon: 'success'
- });
- },
- fail: function () {
- wx.showToast({
- title: '复制失败',
- icon: 'none'
- });
- }
- });
- }
- })
|