于继渤 1 éve
szülő
commit
745dafd01f

+ 1 - 1
api/pages/ivt/inboundItem.js

@@ -19,7 +19,7 @@ module.exports = {
 
   routeUrl: {
     inboundItem: { 
-      add: { key: 'add', url: '/package-inventory/pages/cost-check/add/add'  },
+      add: { key: 'add', url: '/package-inventory/pages/cost-check/cost-check-list/add/add'  },
       chooseStaff: { key: 'chooseStaff', url: '/package-base-select/pages/select-data/select-data',type:'staff'  },
       chooseOrg: { key: 'chooseOrg',url: '/package-base-select/pages/select-data/select-data',type:'org' }, 
       chooseIntType: { key: 'chooseIntType',url: '/package-base-select/pages/select-data/select-data',type:'kindData' ,kindType:'入库类型'}, 

+ 2 - 0
app.json

@@ -121,6 +121,8 @@
                 "pages/inventory-check/add/add",
                 "pages/inventory-check/detail/detail",
                 "pages/cost-check/cost-check",
+                "pages/cost-check/cost-check-list/cost-check-list",
+                "pages/cost-check/cost-check-list/add/add",
                 "pages/ivt-warning-report/ivt-warning-report",
                 "pages/ivt-warning-report/ivit-warning-report-setting/ivit-warning-report-setting"
             ]

+ 92 - 63
package-inventory/pages/cost-check/cost-check-list/add/add.js

@@ -1,66 +1,95 @@
-// package-inventory/pages/cost-check/cost-check-list/add/add.js
+const mixins = require('@/mixins/index.js')
 Page({
-
-    /**
-     * 页面的初始数据
-     */
-    data: {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
+  mixins: [mixins],
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    tableData: [],
+    // 路由
+    routeObjName: 'inboundItem',
+    buttonSaveList: [
+      { code: 'add', title: mixins.$t('costCheck'), },
+    ],
+    // 内容一定
+    content: [
+      {
+        left: { tag: 'brandName', title: 'skuModel', type: 'title' },
+      },
+      {
+        left: { name: 'skuName', },
+      },
+      {
+        left: { name: 'priceInto', type: 'price' },
+        right: { name: 'costPrice', title: '入库核对单价', type: 'price' }
+      },
+      {
+        left: { name: 'nonStdCode', title: '色号:' },
+        right: { name: 'whName' },
+
+      },
+      {
+        left: { name: 'skuSpec', title: '规格:' },
+        right: { name: 'packBox', title: '箱片:' },
+      },
+      {
+        left: { name: 'intoQty', title: '入库数量:' },
+        right: { name: 'seriesName', title: '系列:' },
+      }
+    ],
+    
+  },
+  /**
+  * @desc : 入库单据输入事件
+  * @date : 2024/2/1 15:49
+  * @author : 于继渤
+  */
+  changeAmount(e) {
+    let index = e.detail.index
+    let key = e.detail.key
+    let value = e.detail.value
+    let tableData = this.data.tableData;
+    if (tableData && tableData[index]) {
+      tableData[index][key] = Number(value)
+      tableData[index].costAmt = (Number(tableData[index][key] * tableData[index].intoQty)).toFixed(2)
     }
+    this.setData({
+      tableData: tableData
+    })
+  },
+  /**
+   * @desc : 设置保存参数
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
+  setParams(params) {
+    params = []
+    params = this.data.tableData
+    return params
+  },
+
+  /**
+   * @desc : 保存数据服务
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
+  saveData() {
+    return this.excute(this.data.service, this.data.service.costCheckOk, this.data.params);
+  },
+  /**
+  * 生命周期函数--监听页面加载
+  */
+  loadInit() {
+    let that = this
+    const eventChannel = this.getOpenerEventChannel()
+    eventChannel.on('params', function (data) {
+      data.chooseList.forEach(it => {
+        it.costPrice =  it.costPrice ? it.costPrice :  it.priceInto 
+        it.costAmt = Number(it.costPrice)* Number(it.intoQty)
+      })
+      that.setData({
+        tableData: data.chooseList
+      })
+    })
+  }
 })

+ 2 - 1
package-inventory/pages/cost-check/cost-check-list/add/add.json

@@ -1,3 +1,4 @@
 {
-    "usingComponents": {}
+  "usingComponents": {},
+  "navigationBarTitleText":"成本核对"
 }

+ 5 - 2
package-inventory/pages/cost-check/cost-check-list/add/add.wxml

@@ -1,2 +1,5 @@
-<!--package-inventory/pages/cost-check/cost-check-list/add/add.wxml-->
-<text>package-inventory/pages/cost-check/cost-check-list/add/add.wxml</text>
+<!-- 列表区 -->
+<dk-list list="{{tableData}}" detailReportFlag="{{true}}" titleImageFlag="{{false}}" flgPoint="{{false}}" chooseFlag="{{false}}" bind:choose="listChoose" title="intoNo" subTitle="intoDate" status="intoStatusName" buttonList="{{popbuttonList}}" content="{{content}}" contentCol="{{contentCol}}" bind:changeNumberInput="changeAmount" contentObj="{{contentObj}}"></dk-list>
+
+<!--  保存 -->
+<dk-save-button btnAutoWidthFlag="{{true}}"  btnRightFlag="{{false}}" buttonList="{{buttonSaveList}}" contentList="{{contentSaveList}}" bind:open="save"></dk-save-button>

+ 277 - 51
package-inventory/pages/cost-check/cost-check-list/cost-check-list.js

@@ -1,66 +1,292 @@
-// package-inventory/pages/cost-check/cost-check-list/cost-check-list.js
+const mixins = require('@/mixins/index.js')
+const api = require('@/utils/api.js');
+const config = require('@/config/config.js');
+const Constants = require('@/utils/Constants');
+const util = require('@/utils/util.js')
+const app = getApp()
 Page({
-
-    /**
-     * 页面的初始数据
-     */
-    data: {
-
+  mixins: [mixins],
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    tableData: [],
+    showSearch: false,
+    initSearchFlag: true,
+    buttonSaveList: [
+      { code: 'add', title: mixins.$t('costCheck'), },
+    ],
+    contentSaveList: [{
+      code: 'flag',
+      title: mixins.$t("allChoose"),
+      type: 'checkbox'
+    },],
+    cardList: ['main'],
+    refreshByAdd:true,
+    contentObj: {
+      main: [
+        { code: 'intoType', name: 'intoType', type: 'chooseAndStr', required: true, title: mixins.$t('intType'), urlKey: 'chooseIntType' },
+        { code: 'supName', type: 'str', required: false, title: mixins.$t('supplier') },
+        { code: 'enterWhDate', name: 'enterWhDate', type: 'dateDay', required: false },
+        { code: 'createTime', name: 'createTime', type: 'dateDay', required: false },
+        { code: 'staffId', name: 'staffName', type: 'choose', required: false, title: mixins.$t('staffId'), urlKey: 'chooseStaff' },
+        { code: 'orgId', name: 'orgName', type: 'choose', required: false, title: mixins.$t('orgTwo'), urlKey: 'chooseOrg' }
+      ]
     },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-
+    // 查询条件
+    searchContent: [{
+      code: 'intoDate',
+      title: mixins.$t('currentMonth'),//本月',
+      defaultValue: 2,
+      searchType: Constants.searchType.date
     },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
+    {
+      code: 'staff',
+      title: mixins.$t("staffId"),
+      dropType: 'staff'
     },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
+    {
+      code: 'org',
+      title: mixins.$t("orgId"),
+      dropType: 'org'
     },
+    {
+      code: 'choose',
+      title: mixins.$t('choose'),//'筛选',
+      searchType: Constants.searchType.pick
+    }],
+    // 查询条件-筛选
+    pullMenuList: [
+      {
+        code: 'intoStatus',
+        pullType: 'mSelect',
+        typeName: 'intoStatus'
+      },
+      {
+        code: 'staffName',
+      },
+      {
+        code: 'orgName',
+      },
+      {
+        code: 'supName',
+      },
+      {
+        code: 'intoDate',
+        dataType: 'date'
+      },
+      {
+        code: 'viewNoCostDocuments',
+        dataType: 'checkbox'
+      },
+    ],
+    statusImage: 'verified.png',
+    // 内容一定
+    content: [
+      {
+        left: { tag: 'brandName', title: 'skuModel', type: 'title' },
+      },
+      {
+        left: { name: 'skuName', },
+      },
+      {
+        left: { name: 'priceInto', type: 'price' },
+        right: { name: 'intoQty', type: 'qty' }
+      },
+      {
+        left: { name: 'nonStdCode', title: '色号:' },
+        right: { name: 'whName' },
 
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
+      },
+      {
+        left: { name: 'skuSpec', title: '规格:' },
+        right: { name: 'seriesName', title: '系列:' },
+      }
+    ],
+    contentObjList: {
+      '已核对':
+        [
+          {
+            left: { tag: 'brandName', title: 'skuModel', type: 'title' },
+          },
+          {
+            left: { name: 'skuName', },
+          },
+          {
+            left: { name: 'costPrice', type: 'price' },
+            right: { name: 'intoQty', type: 'qty' }
+          },
+          {
+            left: { name: 'nonStdCode', title: '色号:' },
+            right: { name: 'whName' },
 
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
+          },
+          {
+            left: { name: 'skuSpec', title: '规格:' },
+            right: { name: 'seriesName', title: '系列:' },
+          }
+        ],
+        '未核对':
+        [
+          {
+            left: { tag: 'brandName', title: 'skuModel', type: 'title' },
+          },
+          {
+            left: { name: 'skuName', },
+          },
+          {
+            left: { name: 'priceInto', type: 'price' },
+            right: { name: 'intoQty', type: 'qty' }
+          },
+          {
+            left: { name: 'nonStdCode', title: '色号:' },
+            right: { name: 'whName' },
 
+          },
+          {
+            left: { name: 'skuSpec', title: '规格:' },
+            right: { name: 'seriesName', title: '系列:' },
+          }
+        ]
     },
+    // 路由
+    routeObjName: 'inboundItem',
+  },
 
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
+  /**
+  * @desc : 全选
+  * @date : 2024/2/1 15:49
+  * @author : 于继渤
+  */
+  allChoose(e) {
+    let btnFormData = this.data.btnFormData ? JSON.parse(this.data.btnFormData) : ''
+    let tableData = this.data.tableData
+    tableData.forEach(res => {
+      res.checked = btnFormData.flag
+    })
+    this.setData({
+      tableData: tableData
+    })
+  },
+  /**
+  * @desc : 选择事件
+  * @date : 2024/2/1 15:49
+  * @author : 于继渤
+  */
+  listChoose(e) {
+    let tableData = this.data.tableData
+    tableData[e.detail.index].checked = e.detail.checked
+    this.setData({
+      tableData: tableData
+    })
+  },
+  /**
+  * @desc : 核对成本跳转
+  * @date : 2024/2/1 15:49
+  * @author : 于继渤
+  */
+  toAdd() {
+    console.log('核对成本跳转', this.data.route.add.url)
+    let tableData = this.data.tableData
+    let chooseList = []
+    chooseList = tableData.filter(res => {
+      return res.checked
+    })
+    if (chooseList.length == 0) {
+      util.showToast('请选择一条数据');
+      return
+    }
+    let this_ = this
+    wx.navigateTo({
+      url: this.data.route.add.url,
+      events: {
+        // 回调后
+        bindData: function (data) {}
+      },
+      success: function (res) {
+        res.eventChannel.emit('params', {
+          chooseList: chooseList
+        })
+      }
+    })
+  },
+  onShow(){
+    this.searchData()
+  },
+  /**
+  * @desc : 选择数据源
+  * @date : 2024/2/1 15:49
+  * @author : 于继渤
+  */
+  chooseData(e) {
+    let formData = JSON.parse(this.data.formData)
+    let code = e.detail.code
+    let data = e.detail.data.data
+    if (code == "staffId") { //员工
+      formData.staffId = data.id
+      formData.staffName = data.name
+    }
+    if (code == "orgId") { //部门
+      formData.orgId = data.id
+      formData.orgName = data.name
+    }
+    if (code == "intoType") { //部门
+      formData.intoType = data.name
+    }
+    this.setData({
+      formData: JSON.stringify(formData)
+    })
+  },
+  /**
+    * @desc : 查询
+    * @date : 2024/2/1 15:49
+    * @author : 于继渤
+    */
+  doSearch() {
+    let formData = JSON.parse(this.data.formData)
+    if (!formData.intoType) {
+      util.showToast('请输入/选择入库类型');
+      return
+    }
+    this.setData({
+      btnFormData: JSON.stringify({ flag: false }),
+      showSearch: false
+    })
+    // 重新查询
+    this.searchData()
+  },
+  /**
+    * @desc : 重置
+    * @date : 2024/2/1 15:49
+    * @author : 于继渤
+    */
+  resetting() {
+    this.setData({
+      formData: null
+    })
+  },
 
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
+  /**
+    * @desc : 设置查询参数
+    * @date : 2024年3月8日
+    * @author : 于继渤
+    */
+  setSearchParams(params) {
+    if(params.intoDateStart.indexOf('/') != -1){
+      params.intoDateStart =  params.intoDateStart.replace(/\//g, '-')
+      params.intoDateEnd =  params.intoDateEnd.replace(/\//g, '-')
+    }
+    return params;
+  },
+  /**
+   * @desc : 加载数据
+   * @author : 于继渤
+   * @date : 2024/1/23 9:16
+   */
+  getData(params) {
 
-    },
+    return this.excute(this.data.service, this.data.service.selectCostCheck, params);
+  },
 
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
 
-    }
 })

+ 2 - 1
package-inventory/pages/cost-check/cost-check-list/cost-check-list.json

@@ -1,3 +1,4 @@
 {
-    "usingComponents": {}
+  "usingComponents": {},
+  "navigationBarTitleText":"成本核对"
 }

+ 51 - 2
package-inventory/pages/cost-check/cost-check-list/cost-check-list.wxml

@@ -1,2 +1,51 @@
-<!--package-inventory/pages/cost-check/cost-check-list/cost-check-list.wxml-->
-<text>package-inventory/pages/cost-check/cost-check-list/cost-check-list.wxml</text>
+<!-- 前台导入wxmlUtil.wxs -->
+<wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
+<loading wx:if="{{loading}}"></loading>
+<van-sticky wx:if="{{!showSearch}}" scroll-top="0" id="sticky">
+  <!-- 查询条件 -->
+  <dk-dropdown-menu model:value="{{searchForm}}" menuList="{{searchContent}}" pullMenuList="{{pullMenuList}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['inOrderNo','skuName','skuModel'])}}">
+  </dk-dropdown-menu>
+</van-sticky>
+
+
+<!-- 列表区 -->
+<dk-list wx:if="{{!showSearch}}" statusImageFlag="{{true}}" statusImageFlagValue="flgCostCheck" statusImage="{{statusImage}}" list="{{tableData}}" detailReportFlag="{{true}}" titleImageFlag="{{false}}" flgPoint="{{false}}" chooseFlag="{{true}}" bind:choose="listChoose" title="intoNo" subTitle="intoDate" status="intoStatusName" buttonList="{{popbuttonList}}" content="{{content}}" contentCol="flgCostCheckName" contentObj="{{contentObjList}}"></dk-list>
+
+
+
+
+<!-- 显示没用更多 -->
+<van-divider wx:if="{{noMore}}" contentPosition="center" borderColor="#DCDCDC">{{$t['noMore']}}~</van-divider>
+
+<view style="position: fixed;bottom: 230rpx;right: 30rpx;">
+  <view bind:tap="export" class="btn-add-class">
+    <van-icon name="share" color="#FFFFFF" size="60rpx" />
+  </view>
+</view>
+
+
+<!--  保存 -->
+<dk-save-button wx:if="{{!showSearch}}" model:value="{{btnFormData}}" btnAutoWidthFlag="{{true}}" contentLineFlag="{{true}}" btnRightFlag="{{false}}" bind:change="allChoose" buttonList="{{buttonSaveList}}" contentList="{{contentSaveList}}" bind:open="toAdd"></dk-save-button>
+
+<view wx:if="{{ showSearch }}" overlay="{{false}}" style="border: 1px solid #000000;border-radius: 16rpx;box-shadow: 0px 10px 20px 0px #E1E5EE99;background: #95A8CB1A;margin:20rpx;margin-top:35%;">
+  <view style="padding:10rpx;">
+    <dk-form id="{{formName}}" routeObjName="{{routeObjName}}" cardList="{{cardList}}" contentObj="{{contentObj}}" model:value="{{formData}}" transparentStyle="{{true}}" class="" bind:chooseData="chooseData">
+    </dk-form>
+    <view style="display: flex;width: 90%;margin: 20rpx;">
+      <view style="width: 50%;"></view>
+      <view style="display: flex;width: 50%;justify-content: center;">
+        <view>
+          <van-button plain color="#00A7B5" block custom-style="border-radius: 20rpx;background: #95A8CB1A;width:160rpx;height:60rpx" bind:tap="resetting" type="info">重置</van-button>
+        </view>
+        <view style="margin-left: 15px;">
+          <van-button plain color="#00A7B5" block custom-style="border-radius: 20rpx;background: #95A8CB1A;width:160rpx;height:60rpx" bind:tap="doSearch" type="info">查询</van-button>
+        </view>
+      </view>
+    </view>
+
+
+
+  </view>
+
+
+</view>

+ 52 - 28
package-inventory/pages/cost-check/cost-check.js

@@ -10,6 +10,7 @@ const mixins = require('@/mixins/index.js')
 import Dialog from '@/dist/dialog/dialog.js';
 import { toThousandCents } from '@/utils/common';
 const config = require('@/config/config.js');
+const Constants = require('@/utils/Constants');
 const util = require('@/utils/util.js')
 const app = getApp()
 Page({
@@ -25,24 +26,31 @@ Page({
     choosedGoodsList: [],
     commonService: app.globalData['commonService'],
     inboundItemService: app.globalData['inboundItemService'],
-    skuIdFlag:false,
+    costCheckListURL: '/package-inventory/pages/cost-check/cost-check-list/cost-check-list',
+    skuIdFlag: false,
     typeList: [{
       brandName: '全部品牌',
 
     },
     {
       brandName: '外协品',
-      skuIdFlag:true
+      skuIdFlag: true
     }
     ],
     dataDefaultSearch: util.getCurrentMonth(),
     brandId: null,
     active: 0,
     // 确定按钮
-    buttonList: [{
-      name: 'confirm',
-      title: '保存'
-    }],
+    buttonList: [
+      {
+        plain: true,
+        code: 'collection',
+        title: '修改成本'
+      },
+      {
+        code: 'save',
+        title: '保存'
+      }],
     dateDefault: {
       text: '本月',
       value: 3
@@ -216,18 +224,18 @@ Page({
      * @author : 周兴
      * @date : 2022/8/1 12:16
      */
-    scrollToLower() {
-        if (this.data.loading || this.data.noMore) {
-            return;
-        }
-        this.setData({
-            pageInfo: {
-                pageSize: this.data.pageInfo.pageSize,
-                currentPage: this.data.pageInfo.currentPage + 1
-            }
-        })
-        this.searchData('more')
-    },
+  scrollToLower() {
+    if (this.data.loading || this.data.noMore) {
+      return;
+    }
+    this.setData({
+      pageInfo: {
+        pageSize: this.data.pageInfo.pageSize,
+        currentPage: this.data.pageInfo.currentPage + 1
+      }
+    })
+    this.searchData('more')
+  },
 
   /**
    * @desc : 左侧分类切换
@@ -350,18 +358,34 @@ Page({
    * @date : 2024/2/1 15:49
    * @author : 于继渤
    */
-  submit() {
-    let choosedGoodsList = this.data.choosedGoodsList
-    if (choosedGoodsList.length == 0) {
-      // 是否弹出询问框
-      Dialog.alert({
-        message: '至少补录一条数据',
-      }).then(() => {
-      }).catch(() => {
+  submit(e) {
+    if (e.detail.name == 'collection') {
+      //修改成本
+      let that = this
+      wx.navigateTo({
+        url: that.data.costCheckListURL,
+        events: {
+          refresh: function (data) {}
+        },
+        success: function (res) {
+          res.eventChannel.emit('params', { formMode: Constants.formMode.index })
+        }
       })
-      return
+    } else {
+      //保存
+      let choosedGoodsList = this.data.choosedGoodsList
+      if (choosedGoodsList.length == 0) {
+        // 是否弹出询问框
+        Dialog.alert({
+          message: '至少补录一条数据',
+        }).then(() => {
+        }).catch(() => {
+        })
+        return
+      }
+      this.save({})
     }
-    this.save({})
+
   },
 
   /**