瀏覽代碼

优化

master
yujk 3 年之前
父節點
當前提交
1da684e338
共有 5 個檔案被更改,包括 67 行新增45 行删除
  1. +2
    -1
      app.json
  2. +6
    -6
      pages/bank/bank.wxml
  3. +47
    -6
      pages/contract/contract.js
  4. +3
    -31
      pages/contract/contract.wxml
  5. +9
    -1
      utils/API.js

+ 2
- 1
app.json 查看文件

@@ -33,7 +33,8 @@
"pages/contract/add/add",
"pages/fixedAssets/fixedAssets",
"pages/fixedAssets/add/add",
"pages/finance/finance"
"pages/finance/finance",
"pages/contractAssets/fixedAssets"
],
"window": {
"backgroundTextStyle": "light",


+ 6
- 6
pages/bank/bank.wxml 查看文件

@@ -4,7 +4,7 @@
<text style="top:{{isIPX?'54px':'30px'}};">开户行</text>
</view>

<view class="search_box" style="margin-top:{{isIPX?'100px':'75px'}};">
<view class="search_box" id="top_view" style="margin-top:{{isIPX?'100px':'75px'}};">
<van-search
value="{{ value }}"
shape="round"
@@ -15,8 +15,8 @@
/>
<view class="add_btn" bindtap="goAdd"><text>新增</text></view>
</view>
<van-swipe-cell right-width="{{ 65 }}" class="workflow" wx:for="{{depositList}}" wx:key="index">
<scroll-view scroll-y refresher-threshold="0" id="top_view2" style="height:{{scrollHeight}}px" bindscrolltolower="paging" lower-threshold="100">
<van-swipe-cell right-width="{{ 65 }}" class="workflow" wx:for="{{depositList}}" wx:key="index" wx:for-item="item">
<view class="li" bindtap="goUpdate" data-id="{{item.id}}">
<view class="tit_box">
<image src="/image/apply/{{iOf.indexOf(item.bankTypeText,'中国银行') > -1 ? 'ICBC':iOf.indexOf(item.bankTypeText,'农商行') > -1 ? 'RCB':iOf.indexOf(item.bankTypeText,'农业银行') > -1 ? 'ABC':iOf.indexOf(item.bankTypeText,'建设银行') > -1 ? 'CCB':'QT'}}.png" style="width: 25px;height: 25px;"></image>
@@ -32,12 +32,12 @@
</view>
</view>
<view slot="right" class="deleteBox">
<view style="flex: 1;height: 100%;display: flex;align-items: center;">
<image src="../../image/apply/icon_delete.png" style="width: 25px;height: 25px;margin: 0 auto;" data-id="{{item.id}}" data-index="{{index}}" bindtap="delete"></image>
<view style="flex: 1;height: 100%;display: flex;align-items: center;" data-id="{{item.id}}" data-index="{{index}}" bindtap="delete">
<image src="../../image/apply/icon_delete.png" style="width: 25px;height: 25px;margin: 0 auto;" ></image>
</view>
</view>
</van-swipe-cell>
</scroll-view>
<wxs module="iOf">
var indexOf = function(name,value){
return name.indexOf(value);


+ 47
- 6
pages/contract/contract.js 查看文件

@@ -26,7 +26,8 @@ Page({
showRelevance:false,
relevanceList:[],
fileEvent:{},
itemId:""
itemId:"",
contractionId:""
},
goAdd(){
wx.navigateTo({
@@ -43,7 +44,6 @@ Page({
*/
onLoad(options) {
var that = this;

let qu = wx.createSelectorQuery()
qu.select("#top_view").boundingClientRect()
qu.select("#top_ban").boundingClientRect()
@@ -107,6 +107,11 @@ Page({
url: '/pages/contract/add/add?id='+e.currentTarget.dataset.id,
})
},
addAssets(e){
wx.navigateTo({
url: '/pages/contractAssets/fixedAssets?id='+this.data.contractionId,
})
},
delete(e){
UTIL.httpRequest(API.URL_GET_CONTRACTDELETE + e.currentTarget.dataset.id, {method:'GET'}, {
success: (res) => {
@@ -122,17 +127,50 @@ Page({
}
})
},
relevanceBack(){
let params = {
contractionId:this.data.contractionId
}
UTIL.httpRequest(API.URL_GET_ASSETLIST, params, {
success: (rr) => {
this.setData({
'revelanceList':rr.rows,
'showRelevance':true
})
},
})
},
relevanceDelete(e){
console.log(e);
UTIL.httpRequest(API.URL_GET_ASSETREMOVE+ e.currentTarget.dataset.id, {method:'GET'}, {
success: (res) => {
if(res.code==200){
let new_list = this.data.revelanceList
new_list.splice(e.currentTarget.dataset.index,1)
this.setData({'revelanceList':new_list})
UTIL.showToastNoneIcon('删除成功!');
}else{
UTIL.showToastNoneIcon('删除失败!');
}
},
fail:(rr) =>{
console.log(rr);
},
complete:(rr) => {
console.log(rr);
}
})
},
relevance(e){
console.log(e)
let params = {
contractionId:e.currentTarget.dataset.id
}
UTIL.httpRequest(API.URL_GET_ASSETLIST, params, {
success: (rr) => {
console.log(rr)
this.setData({
'revelanceList':rr.rows,
'showRelevance':true
'showRelevance':true,
'contractionId':e.currentTarget.dataset.id
})
},
fail:(rr) =>{
@@ -302,7 +340,10 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {

console.log(this.data.contractionId)
if(this.data.contractionId!=""&&this.data.contractionId!=null){
this.relevanceBack()
}
},

/**


+ 3
- 31
pages/contract/contract.wxml 查看文件

@@ -108,12 +108,12 @@
</view>
<van-swipe-cell right-width="{{ 50 }}" wx:for="{{revelanceList}}" wx:key="index" wx:for-item="item" >
<view class="tr">
<view class="th">{{item.assetTable}}</view>
<view class="th">固定资产</view>
<view class="th">{{item.name}}</view>
<view class="th">{{item.num}}{{item.unit}}</view>
</view>
<view slot="right" class="deleteBoxAsset">
<view style="flex: 1;height: 100%;display: flex;align-items: center;flex-direction: column;justify-content: center;background-color: rgb(255,0,0,0.2);" bindtap="delete" data-id="{{item.id}}" data-index="{{index}}" >
<view style="flex: 1;height: 100%;display: flex;align-items: center;flex-direction: column;justify-content: center;background-color: rgb(255,0,0,0.2);" bindtap="relevanceDelete" data-id="{{item.id}}" data-index="{{index}}" >
<view>
<text style="color:red">删除</text>
</view>
@@ -121,35 +121,7 @@
</view>
</van-swipe-cell>
<view class="tr" >
<button type="primary">新增</button>
</view>
</view>
</scroll-view>
</van-action-sheet>
<van-action-sheet show="{{showRelevance}}" title="可关联资产" bind:close="closeBox">
<scroll-view scroll-y="true" style="height: 700rpx;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-top="0">
<view class="table">
<view class="tr" style="background:#62AD66;color: #fff;border-radius:10px;">
<view class="th">资产类型</view>
<view class="th">资产名称</view>
<view class="th">数量(单位)</view>
</view>
<van-swipe-cell right-width="{{ 50 }}" wx:for="{{revelanceList}}" wx:key="index" wx:for-item="item" >
<view class="tr">
<view class="th">{{item.assetTable}}</view>
<view class="th">{{item.name}}</view>
<view class="th">{{item.num}}{{item.unit}}</view>
</view>
<view slot="right" class="deleteBoxAsset">
<view style="flex: 1;height: 100%;display: flex;align-items: center;flex-direction: column;justify-content: center;background-color: rgb(255,0,0,0.2);" bindtap="delete" data-id="{{item.id}}" data-index="{{index}}" >
<view>
<text style="color:red">删除</text>
</view>
</view>
</view>
</van-swipe-cell>
<view class="tr" >
<button type="primary">新增关联资产</button>
<button type="primary" size="mini" bindtap="addAssets">+</button>
</view>
</view>
</scroll-view>


+ 9
- 1
utils/API.js 查看文件

@@ -295,6 +295,12 @@ const URL_GET_PAYEEEDIT = `${URL_PREFIX}/yinnong/payee/edit`;
//合同关联资产
const URL_GET_ASSETLIST = `${URL_PREFIX}/contraction/asset/list`;

//新增合同关联资产
const URL_GET_ASSETADD = `${URL_PREFIX}/contraction/asset/add`;

//删除合同关联资产
const URL_GET_ASSETREMOVE = `${URL_PREFIX}/contraction/asset/remove/`;


/****************接口地址end****************/

@@ -407,5 +413,7 @@ export {
URL_GET_PROJECTGET,
URL_POST_PROJECTUPDATE,
URL_GET_DEPOSITDETAIL,
URL_POST_DEPOSITUPDATE
URL_POST_DEPOSITUPDATE,
URL_GET_ASSETADD,
URL_GET_ASSETREMOVE
}

Loading…
取消
儲存