Explorar el Código

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/miniapp-v3 into dev

xujing hace 5 años
padre
commit
ce52035716

+ 1
- 0
src/onlineSelling/pages/addHouse/index.js Ver fichero

@@ -84,6 +84,7 @@ export default class extends Component {
84 84
             {
85 85
               houseList.map((item) => {
86 86
                 const checked = !!chooseList.filter(x => x.houseId == item.houseId)[0]
87
+
87 88
                 return (
88 89
                   <Label class="checkbox" key={item.houseId}>
89 90
                     <Checkbox value={item.houseId} checked={checked} >

+ 6
- 0
src/onlineSelling/pages/houseCart/index.js Ver fichero

@@ -113,6 +113,12 @@ export default class extends Component {
113 113
   // 添加到选择列表
114 114
   // 注意, 不是确认选择
115 115
   add2Cart = (room) => {
116
+    const locked = room.houseLockingStatus == 'locked'
117
+    if (locked) {
118
+      Taro.showToast({ title: '该房源已经被锁定', icon: 'none' })
119
+      return;
120
+    }
121
+
116 122
     const { chooseList } = this.state
117 123
     const checked = (chooseList || []).filter(x => x.houseId == room.houseId)[0]
118 124
 

+ 3
- 1
src/onlineSelling/pages/houseList/index.js Ver fichero

@@ -260,8 +260,10 @@ export default class HouseList extends Component {
260 260
   }
261 261
 
262 262
   handleRecordBtn = e => {
263
-    this.goto('/onlineSelling/pages/records/index')
263
+    const { salesBatchDetail } = this.state
264
+    this.goto(`/onlineSelling/pages/records/index?id=${salesBatchDetail.salesBatchId}`)
264 265
   }
266
+
265 267
   currentPageAndParams() {
266 268
     const id = this.$router.params.id || this.state.id
267 269
     const {

+ 44
- 12
src/onlineSelling/pages/records/index.js Ver fichero

@@ -11,11 +11,14 @@ import Statement from '../../components/Statement'
11 11
 import { transferImage } from '@/utils/tools'
12 12
 import PickerComponent from '../../components/Picker'
13 13
 import './index.scss'
14
+import * as houseActions from '@/actions/house'
15
+
16
+function noop(){}
14 17
 
15 18
 @connect(
16
-  ({ user, city }) => ({ ...user, ...city })
19
+  ({ user, city, house }) => ({ ...user, ...city, house }),
20
+  { ...houseActions }
17 21
 )
18
-
19 22
 export default class Records extends Component {
20 23
   config = {
21 24
     navigationBarTitleText: '选房记录'
@@ -48,26 +51,35 @@ export default class Records extends Component {
48 51
     lockCustomer: [{ value: '不限', code: '' }, { value: '我自己', code: 'mine' }, { value: '其他人', code: 'other' }],
49 52
     lockCustomerValue: '',
50 53
     customerLocked: '',
54
+
55
+    chooseList: [], // 选中的房源ID列表
51 56
   }
52 57
   componentDidShow() {
53 58
     ready.queue(() => {
54 59
 
55
-      const { userInfo: { person: { personId } } } = this.props
60
+      const { id: salesBatchId } = this.$router.params
61
+      const { userInfo: { person: { personId } }, house } = this.props
56 62
       const params = {
57 63
         personId,
64
+        salesBatchId,
58 65
         pageNumber: 1,
59 66
         pageSize: 999,
60 67
       }
61 68
       this.getPreselection(params)
62 69
       this.getRaise(params)
63 70
       querySalesList().then(res => {
64
-        res.unshift({ salesBatchName: '请选择', salesBatchId: '' })
71
+        res.unshift({ salesBatchName: '请选择', salesBatchId })
65 72
         this.setState({
66 73
           salesList: res || [],
67
-
68 74
         })
69 75
       })
70 76
       this.loadBuildingList()
77
+
78
+      if (house.raiseCart.length) {
79
+        this.setState({ chooseList: house.raiseCart.map(x => x.houseId) })
80
+      }
81
+
82
+      this.setState({ salesBatchId })
71 83
     })
72 84
   }
73 85
   getPreselection(params) {
@@ -111,12 +123,30 @@ export default class Records extends Component {
111 123
   }
112 124
 
113 125
   CheckboxChange = (e) => {
114
-    e.stopPropagation()
115
-    console.log('checkbox发生change事件,携带value值为:', e)
126
+    // 加了一个转整型的处理
127
+    // 因为所有的 houseId 都是整型
128
+    this.setState({ chooseList: e.detail.value.map(x => (x - 0)) })
129
+  }
130
+
131
+  handleSubmit = () => {
132
+    const { recordList, chooseList, salesBatchId } = this.state
133
+    if (!chooseList.length) {
134
+      Taro.showToast({ title: '请选择房源', icon: 'none' })
135
+      return;
136
+    }
137
+
138
+    debugger
139
+    const houseList = recordList.map(x => x.housingInfo).filter(x => chooseList.indexOf(x.houseId) > -1)
140
+    this.props.dispatchFlush2Cart(houseList);
141
+
142
+    Taro.navigateTo({
143
+      url: `/onlineSelling/pages/raiseMoney/index?salesBatchId=${salesBatchId}`
144
+    })
116 145
   }
117 146
 
118 147
   renderPreselection() {
119
-    const { recordList, noRecord } = this.state
148
+    const { recordList, noRecord, chooseList } = this.state
149
+
120 150
     return (
121 151
       <Block>
122 152
         <ScrollView scrollY className="container">
@@ -126,12 +156,14 @@ export default class Records extends Component {
126 156
                 <View>
127 157
                   {
128 158
                     recordList.map((item) => {
159
+                      const checked = (chooseList || []).filter(x => x == item.houseId)[0]
160
+                      const disabled = item.housingInfo.houseLockingStatus == 'locked'
161
+
129 162
                       return (
130 163
                         <Label class="checkbox" >
131
-                          <Checkbox value={item.houseId} checked={item.checked} >
164
+                          <Checkbox value={item.houseId - 0} checked={checked} disabled={disabled}>
132 165
                             <View className="carditem" key={item.preselectionRecordId} >
133
-
134
-                              <HouseCard summary={item} />
166
+                              <HouseCard summary={item} onClick={noop} />
135 167
                             </View>
136 168
                           </Checkbox>
137 169
                         </Label>
@@ -144,7 +176,7 @@ export default class Records extends Component {
144 176
           <Statement />
145 177
         </ScrollView >
146 178
 
147
-        <View className="raise-box"> <View className="raise-btn">认筹房源</View></View>
179
+        <View className="raise-box"> <View className="raise-btn" onClick={this.handleSubmit}>认筹房源</View></View>
148 180
 
149 181
       </Block>
150 182
     )