zhaoxiaohai %!s(int64=2) %!d(string=hai) anos
pai
achega
12e27453d1

+ 4 - 1
packageA/forecast/index.js

@@ -37,8 +37,11 @@ Page({
             "version": 1,
             content: this.data.content
         }).then(res => {
-            console.log(res)
             this.selectComponent('#ListBox').RefreshToComplete();
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
             this.setData({
                 'content.pageNumber': res.pageNumber + 1,
                 'content.pageTotal': res.pageTotal,

+ 8 - 0
packageA/forecast/index.scss

@@ -27,6 +27,14 @@ page {
         padding-left: 158rpx;
         border-bottom: 1px solid #DDDDDD;
 
+        .image {
+            position: absolute;
+            width: 96rpx;
+            height: 96rpx;
+            left: 30rpx;
+            top: 20rpx;
+        }
+
         .title {
             height: 44rpx;
             line-height: 44rpx;

+ 9 - 4
packageA/forecast/index.wxml

@@ -5,13 +5,18 @@
     </view>
     <view class="item" wx:for="{{list}}" wx:key="item.sa_salesforecastmodelid">
         <view class="introduce">
+            <image class="image" src="/static/image/forecast.png" />
             <view class="title line-1">{{item.title}}</view>
-            <view class="explain line-1">提报周期:每{{item.periodtype}}{{item.periodpoint}}{{item.periodtype=='月'?'号':''}}</view>
-            <view class="explain line-1">提报要求:{{item.baseonproject}}</view>
+            <view class="explain line-1">提报周期:每{{item.periodtype}} {{item.periodpointchange}} {{item.periodtype=='月'?'号':''}}</view>
+            <view class="explain line-1">提报要求:{{item.baseonproject=='1'?'按项目及产品类别预测':'按产品类别预测'}}</view>
         </view>
         <view class="handle">
-            <navigator url="./detail?id={{item.sa_salesforecastmodelid}}">创建/编辑提报</navigator>
-            <navigator url="./record?id={{item.sa_salesforecastmodelid}}">提报记录</navigator>
+            <navigator url="./detail?id={{item.sa_salesforecastmodelid}}">
+                <van-icon size='24rpx' name="add-o" /> 创建/编辑提报
+            </navigator>
+            <navigator url="./record?id={{item.sa_salesforecastmodelid}}">
+                <van-icon size='24rpx' name="search" /> 提报记录
+            </navigator>
         </view>
     </view>
     <view style="height:30px;" />

+ 97 - 47
packageA/forecast/record.js

@@ -1,66 +1,116 @@
-// packageA/forecast/record.js
+const _Http = getApp().globalData.http;
 Page({
-
     /**
      * 页面的初始数据
      */
     data: {
-
+        list: [],
+        showArr: [],
+        "content": {
+            "sa_salesforecastmodelid": null,
+            "pageNumber": 1,
+            "pageSize": 20,
+            "pageTotal": 1,
+            "where": {
+                "condition": ""
+            }
+        },
+        total: 0
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-
+        this.setData({
+            'content.sa_salesforecastmodelid': options.id,
+            userid: wx.getStorageSync("userMsg").userid
+        })
+        this.getList();
+        this.getShowArr();
     },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
+    /* 开始搜索 */
+    startSearch({
+        detail
+    }) {
+        this.setData({
+            'content.where.condition': detail.trim()
+        });
+        this.getList(true);
     },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
+    cancelSearch() {
+        this.setData({
+            'content.where.condition': ""
+        });
+        this.getList(true);
     },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
+    /* 展示列表 */
+    getShowArr() {
+        return _Http.basic({
+            "id": 20220906150303,
+            "version": 1,
+            "content": {
+                "sa_salesforecastmodelid": this.data.content.sa_salesforecastmodelid
+            }
+        }).then(res => {
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                showArr: [{
+                    label: "订单金额(万元)",
+                    value: res.data.orderamountsum
+                }, {
+                    label: "出货金额(万元)",
+                    value: res.data.outamountsum
+                }, {
+                    label: "开票金额(万元)",
+                    value: res.data.invoiceamountsum
+                }, {
+                    label: "订货数量(个)",
+                    value: res.data.orderqtysum
+                }, {
+                    label: "出货数量(个)",
+                    value: res.data.outqtysum
+                }, {
+                    label: "开票数量(个)",
+                    value: res.data.invoiceqtysum
+                }]
+            })
+        })
     },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
+    getList(init = false) {
+        //init 用于初始化分页
+        if (init.detail != undefined) init = init.detail;
+        if (init) this.setData({
+            ['content.pageNumber']: 1
+        })
+        if (this.data.content.pageNumber > this.data.content.pageTotal) return;
+        return _Http.basic({
+            "id": 20220906150403,
+            "version": 1,
+            content: this.data.content
+        }).then(res => {
+            console.log("列表", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                'content.pageNumber': res.pageNumber + 1,
+                'content.pageTotal': res.pageTotal,
+                list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+                total: res.total
+            })
+        })
     },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
+    onPullDownRefresh: function () {
+        Promise.all([this.getList(true), this.getShowArr()]).then(res => {
+            wx.stopPullDownRefresh()
+        })
     },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
     onReachBottom() {
-
+        this.getList();
     },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
+    onShareAppMessage() {}
 })

+ 2 - 1
packageA/forecast/record.json

@@ -1,4 +1,5 @@
 {
     "usingComponents": {},
-    "navigationBarTitleText": "销售记录"
+    "navigationBarTitleText": "销售记录",
+    "enablePullDownRefresh": true
 }

+ 103 - 1
packageA/forecast/record.scss

@@ -1 +1,103 @@
-/* packageA/forecast/record.wxss */
+.list-box {
+    display: flex;
+    width: 100vw;
+    height: 125rpx;
+    background-color: #fff;
+    border-bottom: 1rpx solid #dddddd;
+    padding: 0 30rpx;
+    box-sizing: border-box;
+
+    .circle {
+        width: 64rpx;
+        height: 64rpx;
+        line-height: 64rpx;
+        text-align: center;
+        background-color: #3874F6;
+        border-radius: 50%;
+        overflow: hidden;
+        color: #fff;
+        font-size: 24rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #FFFFFF;
+        margin: 18rpx 20rpx 0 0;
+        flex-shrink: 0;
+    }
+
+    .content {
+        flex: 1;
+
+        .title {
+            display: flex;
+            height: 48rpx;
+            color: #000000;
+            margin-top: 14rpx;
+
+            .line-1 {
+                max-width: 450rpx;
+                line-height: 48rpx;
+                font-size: 28rpx;
+                font-family: PingFang SC-Regular,
+                    PingFang SC;
+                margin-right: 20rpx;
+            }
+        }
+
+        .time {
+            font-size: 24rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #999999;
+            margin-top: 6rpx;
+        }
+    }
+
+    .right {
+        flex-shrink: 0;
+        display: flex;
+        align-items: center;
+    }
+}
+
+.total {
+    width: 100vw;
+    height: 56rpx;
+    line-height: 56rpx;
+    text-align: center;
+    font-size: 24rpx;
+    font-family: PingFang SC-Regular, PingFang SC;
+    color: #999999;
+}
+
+/* 概况数据展示 */
+.data-display {
+    display: flex;
+    flex-wrap: wrap;
+    justify-content: space-around;
+    width: 100vw;
+    height: 290rpx;
+    background-color: #fff;
+
+    .item {
+        width: 33.33%;
+        height: 100rpx;
+        margin-top: 30rpx;
+        text-align: center;
+
+        .label {
+            height: 34rpx;
+            line-height: 34rpx;
+            font-size: 24rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #999999;
+        }
+
+        .nubmer {
+            height: 50rpx;
+            line-height: 50rpx;
+            font-size: 36rpx;
+            font-family: PingFang SC-Bold, PingFang SC;
+            font-weight: bold;
+            color: #333333;
+            margin-top: 14rpx;
+        }
+    }
+}

+ 25 - 2
packageA/forecast/record.wxml

@@ -1,2 +1,25 @@
-<!--packageA/forecast/record.wxml-->
-<text>packageA/forecast/record.wxml</text>
+<van-search value="{{ condition }}" shape="round" background="var(--primary)" bind:search='startSearch' bind:clear='cancelSearch' placeholder="搜索" />
+<view class="data-display">
+    <view class="item" wx:for="{{showArr}}" wx:key="index">
+        <view class="label">{{item.label}}</view>
+        <view class="nubmer">{{item.value}}</view>
+    </view>
+</view>
+
+<view class="total">
+    总共{{total}}个
+</view>
+
+<navigator url="#" class="list-box" wx:for="{{list}}">
+    <view class="circle">{{item.name[0]}}</view>
+    <view class="content">
+        <view class="title">
+            <view class="line-1">{{item.name}}</view>
+            <van-tag type="warning" plain wx:if="{{item.userid==userid}}">我的</van-tag>
+        </view>
+        <view class="time">提报时间:{{item.createdate}}</view>
+    </view>
+    <view class="right">
+        <van-icon name="arrow" color='#CCCCCC' />
+    </view>
+</navigator>

BIN=BIN
static/image/forecast.png