ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

小程序点餐系统——基本配置(utils)

2021-04-08 17:05:33  阅读:209  来源: 互联网

标签:const color utils 程序 date 点餐 font order size


文章目录

基本配置(utils)

公共css

/* 订单详情部分 */
.order-info{
  background: white;
  margin-top:10px;
}
.order-info-title{
  font-size:12px;
  color: #D1D1D1;
  padding: 12px;
  border-bottom: 1px #E3E3E3 solid
}
/* 清单数量 */
.cart-list-box{
  background:#FFFFFF;
  display:flex;
  font-size:15px;
  border-bottom:1px #E3E3E3 solid;
}
.list-info{
  width:50%;
  padding:5px 15px;
}
.list-info-size{
  font-size:12px;
  color:#B1B1B1;
}
/* 总金额超过20,出现满减 */
.order-cut{
  height:30px;
  padding:5px 15px;
  border-bottom: 1px #E3E3E3 solid;
}
.order-cut-dec{
  background:#F07474;
  font-size:13px;
  color:white;
  padding:2px
}
.order-cut-note{
  margin-left:3px;
  font-size:14px
}
.order-cut-number{
  font-size:14px;
  float:right;
}
/* 总计 */
.order-sum{
  height:30px;
  padding:5px 15px;
  font-size:14px;
}
.order-sum-number{
  font-size:14px;
  float:right;
}
.activity-color{
  color:#FF9C35;
}

fetch.js 接口的请求

第五行要换成你自己服务器的IP地址。如果没有服务器就在本地开启node服务器,用本地的端口

module.exports = function(path, data, method) {
  // 暴露接口
  return new Promise((resolve, reject) => {
    wx.request({
      url: 'http://你自己的服务器ip:8081/api/' + path, //api地址
      // url: 'http://127.0.0.1:8081/api/' + path, //api地址
      method: method, // 请求方法
      data: data, // 参数
      header: {
        'Content-Type': 'json'
      }, // 请求头,默认
      success: resolve,
      fail: function() {
        reject()
        wx.showModal({
          showCancel: false,
          title: '失败'
        })
      }
    })
  })
}

util.js 公共方法

这里只有初始化时间方法

const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}

// const formatNumber = n => {
//   n = n.toString()
//   return n[1] ? n : '0' + n
// }

const formatNumber = function(n){
  n = n.toString()
  return n[1] ? n : '0' + n
}
module.exports = {
  formatTime: formatTime
}


标签:const,color,utils,程序,date,点餐,font,order,size
来源: https://blog.csdn.net/weixin_45525272/article/details/115524784

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有