toPay(){//支付 console.log(util.formatTime(new Date)) wx.cloud.database().collection('shop').add({ // data:{ name:this.data.name, phone:this.data.phone, address:this.data.address, totalpay:this.data.sum, // orderId:this.data.orderId, product:this.data.orderList,//是一个数组,也是一个对象 time:util. formatTime(new Date), note:this.data.note, status:-1,//代表发货状态 // -1 用户自动取消 // 0 待发货 // 1 已发货 // 2 已评价 } }).then(res=>{ console.log(res._id) let orderId=res._id this.setData({ orderId:orderId//创建订单成功 }) this.xuniPay()//虚拟支付 }) },解释
时间: 2024-02-15 16:27:01 浏览: 29
这是一段小程序中的支付函数代码,主要实现以下功能:
1.使用console.log输出当前时间,即util.formatTime(new Date)。
2.在云数据库的shop集合中添加一条记录,记录包括购买者的姓名、电话、地址、总支付金额、订单中的商品列表、下单时间、备注和发货状态。
3.在添加记录成功后,将订单的ID保存到小程序页面的数据中,并调用xuniPay函数进行虚拟支付。
其中,云数据库是腾讯云提供的一种基于云端的NoSQL数据库服务,可以方便地进行数据的存储和管理。虚拟支付是指在小程序中模拟支付的过程,不涉及真实的资金交易。
相关问题
onLoad() { let that = this wx.getStorage({ key: 'Userinfo', success(res) { //console.log(res.data) //userinfo } }) //console.log(util.formatTime(new Date())); //this.get_DBinf(); //this.navbarTap(); this.get_Sell_DBinf(); }, wanttobuy: function (e) { var that = this var buyind = e.currentTarget.dataset.buyindex //console.log("buyind:" + buyind); const buypostopenid = e.currentTarget.dataset.buypostopenid
在 `onLoad` 函数中,通过 `wx.getStorage` API 获取本地缓存中的 `Userinfo` 数据。同时调用了 `get_Sell_DBinf` 函数,加载了交易市场的数据。在 `wanttobuy` 函数中,通过点击事件获取了对应的购买信息的索引和卖家的 openid。但是这些代码片段并没有展示展示、点赞、评论功能的实现,您能否提供相关的代码片段供我参考?
These dependencies were not found: * core-js/fn/promise in ./src/util/formHtml.js * file-saver in ./src/util/formHtml.js To install them, you can run: npm install --save core-js/fn/promise file-saver These relative modules were not found: * ../../../service/api in ./src/util/element/child.js, ./src/util/vant/child.js * ../../router/router in ./src/util/formHtml.js * ../../service/common in ./src/util/data.js * ../../service/storage in ./src/util/data.js * ../form/control/index in ./src/util/formHtml.js 给我中文解析
这些依赖项未找到:
* 在./src/util/formHtml.js中的core-js/fn/promise
* 在./src/util/formHtml.js中的file-saver
要安装它们,可以运行:npm install --save core-js/fn/promise file-saver
这些相对模块未找到:
* 在./src/util/element/child.js、./src/util/vant/child.js中的../../../service/api
* 在./src/util/formHtml.js中的../../router/router
* 在./src/util/data.js中的../../service/common
* 在./src/util/data.js中的../../service/storage
* 在./src/util/formHtml.js中的../form/control/index