|
@@ -3,18 +3,21 @@
|
|
|
<view class="title" v-text="description.title"></view>
|
|
|
<view class="description">
|
|
|
<view class="tip" v-text="description.tip"></view>
|
|
|
- <view class="content" v-text="description.content"></view>
|
|
|
+ <view class="content" v-text="content"></view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import description from './config/description.js'
|
|
|
+import { fetchShareCouponList } from '@/services/api/coupon.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
entryType: 1,
|
|
|
- descriptionList: description
|
|
|
+ descriptionList: description,
|
|
|
+ types: ['inviteCouponList', 'consumeCouponList', 'shareCouponList'],
|
|
|
+ content: ''
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -27,6 +30,22 @@ export default {
|
|
|
uni.setNavigationBarTitle({
|
|
|
title: options.title
|
|
|
})
|
|
|
+ this.fetchShareCouponList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async fetchShareCouponList() {
|
|
|
+ try {
|
|
|
+ const res = await fetchShareCouponList()
|
|
|
+ const key = this.types[this.entryType - 1]
|
|
|
+ const list = res.data[key]
|
|
|
+ if (list && list.length <= 0) return
|
|
|
+ const priceText = list.map(item => item + '元').join(',')
|
|
|
+ this.content = this.description.content.replace('#price#', priceText)
|
|
|
+ } catch (e) {
|
|
|
+ //TODO handle the exception
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|