C端小程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

104 行
1.6 KiB

  1. var app = getApp();
  2. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
  3. const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
  4. const Http = require("../../utils/HttpBasics");
  5. const config = require("../../config/config.js");
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. navigationBarHeight,
  12. num:1,
  13. showShade:true,
  14. },
  15. addNum(){
  16. let num = this.data.num
  17. if(this.data.num>=10){
  18. wx.showToast({
  19. title: '购买总数超库存',
  20. icon: 'none',
  21. duration: 2000,
  22. })
  23. }else{
  24. num = num + 1
  25. this.setData({
  26. num: num
  27. })
  28. }
  29. },
  30. dleNum(){
  31. let num = this.data.num
  32. if (this.data.num <=1){
  33. wx.showToast({
  34. title: '购买总数不能为0',
  35. icon: 'none',
  36. duration: 2000,
  37. })
  38. }else{
  39. num = num - 1
  40. this.setData({
  41. num: num
  42. })
  43. }
  44. },
  45. /**
  46. * 生命周期函数--监听页面加载
  47. */
  48. onLoad: function (options) {
  49. },
  50. /**
  51. * 生命周期函数--监听页面初次渲染完成
  52. */
  53. onReady: function () {
  54. },
  55. /**
  56. * 生命周期函数--监听页面显示
  57. */
  58. onShow: function () {
  59. },
  60. /**
  61. * 生命周期函数--监听页面隐藏
  62. */
  63. onHide: function () {
  64. },
  65. /**
  66. * 生命周期函数--监听页面卸载
  67. */
  68. onUnload: function () {
  69. },
  70. /**
  71. * 页面相关事件处理函数--监听用户下拉动作
  72. */
  73. onPullDownRefresh: function () {
  74. },
  75. /**
  76. * 页面上拉触底事件的处理函数
  77. */
  78. onReachBottom: function () {
  79. },
  80. /**
  81. * 用户点击右上角分享
  82. */
  83. onShareAppMessage: function () {
  84. }
  85. })