xcx/pages/gwc/gwc-js/gwc-js.js

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// page/component/orders/orders.js
Page({
  data: {
    address: {},
    hasAddress: false,
    total: 0,
    hqdz: false,
    dzxs: true,
    orders: [
      { id: 1, title: 'SOD牙膏', image: 'http://qitai.gotoip4.com/image/cp-image/cp-fm-image/cp1.jpg', num: 4, price: 99.00, selected: true },
      { id: 2, title: 'SOD面膜', image: 'http://qitai.gotoip4.com/image/cp-image/cp-fm-image/cp2.jpg', num: 1, price: 120.00, selected: true }
    ]
  },

  onReady() {
    this.getTotalPrice();
  },

  onShow: function () {
    const self = this;
    wx.getStorage({
      key: 'address',
      success(res) {
        self.setData({
          address: res.data,
          hasAddress: true
        })
      }
    })
  },

  /**
   * 计算总价
   */
  getTotalPrice() {
    let orders = this.data.orders;
    let total = 0;
    for (let i = 0; i < orders.length; i++) {
      total += orders[i].num * orders[i].price;
    }
    this.setData({
      total: total
    })
  },


  //用户选择收货地址
  hqdz() {
    var that = this;
    if (wx.chooseAddress) {
      wx.chooseAddress({
        success: function (res) {
          console.log(JSON.stringify(res));
          console.log(res);
          that.setData({
            "userName": res.userName,
            "telNumber": res.telNumber,
            "provinceName": res.provinceName,
            "cityName": res.cityName,
            "countyName": res.countyName,
后面还有 53 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。