Selaa lähdekoodia

合同先选报价单

zhaoxiaohai 3 vuotta sitten
vanhempi
commit
2dea852727

+ 2 - 1
app.json

@@ -116,7 +116,8 @@
                 "saleClue/translate",
                 "project/modules/contacts/quickly/index",
                 "project/modules/contacts/add/index",
-                "project/modules/contacts/select/index"
+                "project/modules/contacts/select/index",
+                "select/offers/select"
             ]
         }
     ],

+ 53 - 28
packageA/contract/modules/product/index.js

@@ -64,36 +64,61 @@ Component({
         },
         /* 去选择产品 */
         addProduct() {
-            let params = getCurrentPages()[getCurrentPages().length - 1].data.detail.typemx ? {
-                "id": 20221123162902,
-                "version": 1,
-                "content": {
-                    nocache: true,
-                    sa_contractid: this.data.sa_contractid,
-                    pageNumber: 1,
-                    pageTotal: 1,
-                    total: null,
-                    where: {
-                        condition: ""
+            let page = getCurrentPages()[getCurrentPages().length - 1];
+            if (page.data.detail.typemx) {
+                wx.navigateTo({
+                    url: '/packageA/select/offers/select?params=' + JSON.stringify({
+                        "id": 20221222151302,
+                        "content": {
+                            nocache: true,
+                            "sa_projectid": page.data.detail.sa_projectid,
+                            "pageNumber": 1,
+                            "pageSize": 20,
+                            "where": {
+                                "condition": ""
+                            }
+                        }
+                    }),
+                    fail(err) {
+                        console.log(err)
                     }
-                }
-            } : {
-                "id": 20221124093602,
-                "version": 1,
-                "content": {
-                    nocache: true,
-                    sa_contractid: this.data.sa_contractid,
-                    pageNumber: 1,
-                    pageTotal: 1,
-                    total: null,
-                    where: {
-                        condition: "",
-                        "istool": 1 //是否是工具
+                })
+            } else {
+                wx.navigateTo({
+                    url: '/packageA/select/product/select?params=' + JSON.stringify({
+                        "id": 20221124093602,
+                        "version": 1,
+                        "content": {
+                            nocache: true,
+                            sa_contractid: this.data.sa_contractid,
+                            pageNumber: 1,
+                            pageTotal: 1,
+                            total: null,
+                            where: {
+                                condition: "",
+                                "istool": 1 //是否是工具
+                            }
+                        }
+                    })
+                })
+            }
+        },
+        selectOffers(e) {
+            wx.redirectTo({
+                url: '/packageA/select/product/select?params=' + JSON.stringify({
+                    "id": 20221123162902,
+                    "content": {
+                        nocache: true,
+                        "sa_quotedpriceid": e.sa_quotedpriceid,
+                        sa_contractid: this.data.sa_contractid,
+                        pageNumber: 1,
+                        pageTotal: 1,
+                        total: null,
+                        where: {
+                            condition: ""
+                        }
                     }
-                }
-            };
-            wx.navigateTo({
-                url: '/packageA/select/product/select?params=' + JSON.stringify(params)
+                })
             })
         },
         /* 处理选择产品 */

+ 2 - 1
packageA/offers/addProjectOffer.js

@@ -187,9 +187,10 @@ Page({
             ...this.data.content,
             ...this.selectComponent("#Form").submit()
         };
+        console.log(content)
         content.sys_enterpriseid = content.sys_enterpriseid[1][0] || '';
         content.sa_projectid = content.sa_projectid[1][0] || '';
-        content.contactsid = content.contactsid[1][0] || '';
+        content.contactsid = content.contactsid ? content.contactsid[1][0] : '';
 
         content.begdate = content.invaliddate[0];
         content.enddate = content.invaliddate[1];

+ 2 - 2
packageA/offers/addSetclientOffer.js

@@ -95,7 +95,7 @@ Page({
                     placeholder: "选择客户联系人",
                     valueName: "contactsid",
                     checking: "base",
-                    required: true
+                    required: false
                 })
             };
             this.setData({
@@ -135,7 +135,7 @@ Page({
                 placeholder: "选择客户联系人",
                 valueName: "contactsid",
                 checking: "base",
-                required: true
+                required: false
             };
             if (form[1].label == "联系人") {
                 form[1] = obj

+ 1 - 0
packageA/project/index.js

@@ -122,6 +122,7 @@ Page({
                 v.progress = v.stage / v.totalstage * 100;
                 return v
             })
+            
             this.setData({
                 'content.pageNumber': res.pageNumber + 1,
                 'content.pageTotal': res.pageTotal,

+ 111 - 0
packageA/select/offers/select.js

@@ -0,0 +1,111 @@
+const _Http = getApp().globalData.http,
+    getHeight = require("../../../utils/getRheRemainingHeight");
+Page({
+    data: {
+        item: null,
+        result: [],
+        params: {},
+        radio: true,
+    },
+    onLoad(options) {
+        console.log(options)
+        if (options.item) {
+            let item = JSON.parse(options.item);
+            this.setData({
+                item,
+                params: item.params
+            });
+        }
+        if (options.params) this.setData({
+            params: JSON.parse(options.params)
+        })
+        this.setData({
+            radio: options.radio ? true : false
+        })
+        this.getList()
+    },
+    submit(e) {
+        let {
+            data
+        } = e.currentTarget.dataset,
+            pages = getCurrentPages(),
+            page = pages[pages.length - 2].selectComponent("#Product");
+            if(page) page.selectOffers(data);
+    },
+    getList(init = false) {
+        //init 用于初始化分页
+        if (init.detail != undefined) init = init.detail;
+        let params = this.data.params;
+        if (init) params.content.pageNumber = 1
+        if (params.content.pageNumber > params.content.pageTotal) return;
+        _Http.basic(params).then(res => {
+            console.log("选择项目列表", res)
+            this.selectComponent('#ListBox').RefreshToComplete();
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                'params.content.pageNumber': res.pageNumber + 1,
+                'params.content.pageTotal': res.pageTotal,
+                'params.content.total': res.total,
+                list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
+            })
+            this.getTags();
+        })
+    },
+    /* 获取列表标签 */
+    getTags() {
+        let list = this.data.list,
+            ownerids = list.map(v => v.sa_quotedpriceid);
+        _Http.basic({
+            "id": 20221018102001,
+            "content": {
+                nocache: true,
+                "ownertable": "sa_quotedprice",
+                ownerids
+            }
+        }).then(res => {
+            console.log("标签", res)
+            for (let key in res.data) {
+                let index = list.findIndex(v => v.sa_quotedpriceid == key);
+                list[index].tags = res.data[key]
+            };
+            console.log(list)
+            this.setData({
+                list
+            })
+        })
+    },
+    /* 开始搜索 */
+    startSearch({
+        detail
+    }) {
+        let condition = this.data.content ? this.data.content.where.condition : this.data.params.content.where.condition;
+        if (detail == condition) return;
+        this.setData({
+            'content.where.condition': detail,
+            'params.content.where.condition': detail
+        });
+        this.getList(true);
+    },
+    /* 取消搜索 */
+    onClear() {
+        this.setData({
+            'content.where.condition': "",
+            'params.content.where.condition': ""
+        });
+        this.getList(true);
+    },
+    /* 删除项 */
+    deteleItem(id, idName = 'sa_quotedpriceid') {
+        this.setData({
+            list: this.data.list.filter(v => v[idName] != id)
+        })
+    },
+    onReady() {
+        getHeight.getHeight('.total', this).then(res => this.setData({
+            listHeight: res
+        }));
+    }
+})

+ 4 - 0
packageA/select/offers/select.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "选择报价单"
+}

+ 79 - 0
packageA/select/offers/select.scss

@@ -0,0 +1,79 @@
+page {
+    height: 100vh;
+    overflow: hidden;
+}
+
+.total {
+    height: 60rpx;
+    line-height: 60rpx;
+    font-size: 24rpx;
+    font-family: PingFang SC-Regular, PingFang SC;
+    color: #666666;
+    padding-left: 30rpx;
+}
+
+.offer-list {
+    width: 100%;
+    padding: 20rpx 30rpx;
+    box-sizing: border-box;
+    background-color: #fff;
+    border-bottom: 1rpx solid #ddd;
+    font-family: PingFang SC-Regular, PingFang SC;
+
+    .tag-box {
+        margin-top: 10rpx;
+
+        .tag {
+            height: 40rpx;
+            font-size: 20rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            padding: 0 12rpx;
+            margin-right: 8rpx;
+        }
+    }
+
+    .title {
+        position: relative;
+        display: flex;
+        height: 42rpx;
+        align-items: center;
+
+        >text {
+            display: inline-block;
+            width: 80%;
+            font-size: 30rpx;
+            color: #333333;
+        }
+
+        .status {
+            position: absolute;
+            right: -30rpx;
+            width: 132rpx;
+            height: 40rpx;
+            border-radius: 20rpx 0px 0px 20rpx;
+            box-sizing: border-box;
+            padding-left: 30rpx;
+            line-height: 40rpx;
+            font-size: 24rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #FFFFFF;
+        }
+    }
+
+    .exp {
+        height: 34rpx;
+        font-size: 24rpx;
+        color: #666;
+        margin-top: 8rpx;
+
+        text {
+            color: #333333;
+        }
+    }
+}
+
+.line-1 {
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+}

+ 18 - 0
packageA/select/offers/select.wxml

@@ -0,0 +1,18 @@
+<van-search class="search" value="{{ params.content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
+<view class="total">共{{params.content.total}}个</view>
+<My_listBox id='ListBox' height="{{listHeight}}" bind:getlist='getList'>
+    <navigator class="offer-list" url="#" wx:for="{{list}}" wx:key="item.billno" data-data="{{item}}" bindtap="submit">
+        <view class="title">
+            <text class="line-1">单号:{{item.billno}}</text>
+        </view>
+        <view class="tag-box">
+            <van-tag custom-class='tag' wx:for="{{item.tags.systemtag}}" wx:for-item='tag' color='#FA8C16' text-color='#fff' round>{{tag}}</van-tag>
+            <van-tag custom-class='tag' wx:for="{{item.tags.datatag}}" wx:for-item='tag' color='#FAAB16' text-color='#fff' round>{{tag}}</van-tag>
+        </view>
+        <view class="exp line-1">客户:<text>{{item.enterprisename}}</text></view>
+        <view class="exp line-1">报价日期:<text>{{item.billdate}}</text></view>
+        <view class="exp line-1">特价:<text>{{item.specialoffer==1?'是':'否'}}</text></view>
+    </navigator>
+    <view style="height: 230rpx;" />
+    <My_empty wx:if="{{!list.length}}" />
+</My_listBox>

+ 6 - 0
packageA/setclient/modules/project/index.js

@@ -31,6 +31,12 @@ Component({
                     title: res.data,
                     icon: "none"
                 })
+
+                res.data = res.data.map(v => {
+                    v.progress = v.totalstage ? v.stage / v.totalstage * 100 : 0;
+                    return v
+                })
+
                 this.setData({
                     list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
                     "content.pageNumber": res.pageNumber + 1,