report.js
1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
export default {
data () {
return {
goodsId: '',
visitsId: '',
source: ''
}
},
onLoad (options) {
this.visitsId = options.visitsId || ''
this.goodsId = options.id
if (options.source) this.source = options.source
this.addRecord()
},
methods: {
addRecord () {
const { shopMerchantId: merchantId, shopMerchantName: merchantName } = uni.$storage.get('userInfo')
if (!merchantId || !this.goodsId) return
const params = {
goodsId: this.goodsId,
goodsType: 0,
merchantId,
merchantName,
}
if (this.visitsId) params.visitsId = this.visitsId
if (this.source) params.searchSource = this.source
uni.$api.commonApi.addRecord(params).then(res => {
this.addId = res
})
}
},
onUnload () {
if (!this.addId) return
const params = {
id: this.addId
}
if (this.visitsId) params.visitsId = this.visitsId
uni.$api.commonApi.leaveRecord(params).then(res => {
})
}
}