Ver Fonte

产品列表与管理

zhaoxiaohai há 4 anos atrás
pai
commit
690ae659d1

+ 3 - 1
README.md

@@ -6,7 +6,9 @@
 
 ​	tabbar-pages -- tabbar页面
 
-​	teamManagement -- index-团队管理 change-成员管理
+​	teamManagement -- index-团队管理 change-成员新增或修改
+
+​	productManagement -- index-产品管理 change-产品新增或修改
 
 # 自定义组件:
 

+ 6 - 3
app.json

@@ -4,14 +4,17 @@
         "pages/userCenter/index",
         "pages/tabbar-pages/user/index",
         "pages/teamManagement/index",
-        "pages/teamManagement/change"
+        "pages/teamManagement/change",
+        "pages/productManagement/index",
+        "pages/productManagement/change"
+
     ],
     "usingComponents": {
         "van-button": "@vant/weapp/button/index",
         "van-field": "@vant/weapp/field/index",
         "van-icon": "@vant/weapp/icon/index",
-        "My_GeneralTemplate":"/components/My_GeneralTemplate/index",
-        "My_GreyRectangleForm":"/components/My_GreyRectangleForm/index"
+        "My_GeneralTemplate": "/components/My_GeneralTemplate/index",
+        "My_GreyRectangleForm": "/components/My_GreyRectangleForm/index"
     },
     "window": {
         "backgroundTextStyle": "light",

+ 10 - 0
components/My_MembersAndProducts/index.js

@@ -23,6 +23,16 @@ Component({
         /* 第三行 */
         threeRow: {
             type: String
+        },
+        /* 图片尺寸 */
+        imgSize: {
+            type: String,
+            value: "100rpx"
+        },
+        /* 图片圆角 */
+        radius: {
+            type: String,
+            value: '50%'
         }
     },
     options: {

+ 1 - 1
components/My_MembersAndProducts/index.wxml

@@ -1,7 +1,7 @@
 <view class="grey_rectangle" style="padding: 14rpx 30rpx;">
     <view class="grey_rectangle_box">
         <!-- 图片 -->
-        <view class="grey_rectangle_image" style="height: 100rpx; width: 100rpx; border-radius: 50%;">
+        <view class="grey_rectangle_image" style="height: {{imgSize}}; width:{{imgSize}}; border-radius: {{radius}};">
             <image wx:if="{{attinfos.fobsurl}}" src="{{attinfos.fobsurl}}" mode="aspectFill"></image>
             <image wx:else src="/static/userImage.png" mode="aspectFit"></image>
         </view>

+ 23 - 0
pages/productManagement/change.js

@@ -0,0 +1,23 @@
+// pages/productManagement/change.js
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+
+    }
+})

+ 6 - 0
pages/productManagement/change.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+        "van-switch": "@vant/weapp/switch/index"
+    }
+}

+ 31 - 0
pages/productManagement/change.wxml

@@ -0,0 +1,31 @@
+<My_GeneralTemplate padBot="20rpx">
+    <view class="product_message">
+        <My_GreyRectangleForm title="产品名" required>
+            <van-field autosize model:value="{{ fname }}" data-name="fname" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fname}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+        </My_GreyRectangleForm>
+
+        <My_GreyRectangleForm title="产品编码" required>
+            <van-field autosize model:value="{{ fname }}" data-name="fname" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fname}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+        </My_GreyRectangleForm>
+
+        <My_GreyRectangleForm title="产品图" required>
+
+        </My_GreyRectangleForm>
+
+        <My_GreyRectangleForm title="标签" required>
+            <van-field autosize model:value="{{ fname }}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+        </My_GreyRectangleForm>
+
+        <My_GreyRectangleForm title="说明" required>
+            <van-field autosize model:value="{{ fname }}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+        </My_GreyRectangleForm>
+
+        <My_GreyRectangleForm title="是否启用">
+            <van-switch style="position: absolute; margin-left: -110rpx; margin-top: 10rpx;" checked="{{ checked }}" bind:change="onChange" />
+        </My_GreyRectangleForm>
+    </view>
+</My_GeneralTemplate>
+<!-- 提交按钮 -->
+<view class="submit_but">
+    <van-button bindtap="submit" custom-class="custom-class" round color="linear-gradient(180deg, #82E0E9 0%, #4BBECF 100%);">保存</van-button>
+</view>

+ 5 - 0
pages/productManagement/change.wxss

@@ -0,0 +1,5 @@
+@import "/css/form2.wxss";
+
+.product_message {
+    padding: 0 30rpx;
+}

+ 129 - 0
pages/productManagement/index.js

@@ -0,0 +1,129 @@
+import {
+    ApiModel
+} from "../../utils/api";
+const _Http = new ApiModel();
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        active: 0, //tabs选中下标
+        pageNumber: 1, //请求页号
+        productList: [], //产品列表
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+
+    },
+    /* tabs 切换事件 */
+    tabsChange(e) {
+        const {
+            index
+        } = e.detail;
+        this.setData({
+            active: e.detail.index
+        })
+        this.gettingData(index)
+    },
+    /* 获取数据 */
+    gettingData(index, value) {
+        let where = {
+            "condition": "",
+            "fisonsale": ""
+        };
+        //请求类型
+        if (index == 1) {
+            where.fisonsale = 1;
+        } else if (index == 2) {
+            where.fisonsale = 0;
+        }
+        //模糊搜索
+        if (value) {
+            where.condition = value
+        };
+        /* 发送请求 */
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.products.products",
+            "method": "query_productsList",
+            "content": {
+                "getdatafromdbanyway": true,
+                "pageNumber": this.data.pageNumber,
+                "pageSize": 20,
+                "where": where
+            }
+        }).then(res => {
+            console.log(res)
+            if (res.msg != '成功') return;
+            this.setData({
+                productList: res.data
+            })
+            //增加页码
+            if (res.pageTotal > res.pageNumber) {
+                this.setData({
+                    pageNumber: res.pageNumber + 1
+                })
+            }
+        })
+    },
+    /* 产品信息修改 */
+    changeProductMessage(e) {
+        const {
+            index
+        } = e.currentTarget.dataset;
+        console.log(index)
+        
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+        this.gettingData(this.data.active)
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 7 - 0
pages/productManagement/index.json

@@ -0,0 +1,7 @@
+{
+  "usingComponents": {
+    "My_MembersAndProducts": "/components/My_MembersAndProducts/index",
+    "van-tab": "@vant/weapp/tab/index",
+    "van-tabs": "@vant/weapp/tabs/index"
+  }
+}

+ 10 - 0
pages/productManagement/index.wxml

@@ -0,0 +1,10 @@
+<My_GeneralTemplate padBot="20rpx">
+    <view class="product_list">
+        <van-tabs active="{{ active }}" bind:change="tabsChange">
+            <van-tab title="全部" />
+            <van-tab title="上架中" />
+            <van-tab title="已下架" />
+        </van-tabs>
+        <My_MembersAndProducts wx:for="{{productList}}" bind:changeMessage="changeProductMessage" data-index="{{index}}" attinfos="{{item.attinfos[0]}}" imgSize="120rpx" radius="8rpx" title="{{item.fprodname}}" twoRow="{{item.fintroduction}}" threeRow="{{item.ftag}}" fisadministrator></My_MembersAndProducts>
+    </view>
+</My_GeneralTemplate>

+ 3 - 0
pages/productManagement/index.wxss

@@ -0,0 +1,3 @@
+.product_list{
+    padding: 0 30rpx;
+}

+ 6 - 2
pages/tabbar-pages/user/index.js

@@ -41,9 +41,13 @@ Page({
             name
         } = e.target.dataset
         console.log(name)
-        if(name=="团队管理"){
+        if (name == "团队管理") {
             wx.navigateTo({
-              url: '/pages/teamManagement/index',
+                url: '/pages/teamManagement/index',
+            })
+        } else if (name == '产品管理') {
+            wx.navigateTo({
+                url: '/pages/productManagement/index'
             })
         }
     },

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
project.private.config.json


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff