|
@@ -41,21 +41,11 @@
|
|
|
>
|
|
|
</p>
|
|
|
<button
|
|
|
- v-if="
|
|
|
- (item.type == 1 && item.available) || [2, 4].includes(+item.type)
|
|
|
- "
|
|
|
+ v-if="item.available && getButtonText(item)"
|
|
|
class="ptc-button"
|
|
|
@click="onClickButton(item)"
|
|
|
>
|
|
|
- {{
|
|
|
- item.type == 1
|
|
|
- ? 'Apply'
|
|
|
- : item.type == 2
|
|
|
- ? item.button_name
|
|
|
- : item.receive_method == 2
|
|
|
- ? 'Nearby shops'
|
|
|
- : 'Send to me'
|
|
|
- }}
|
|
|
+ {{ getButtonText(item) }}
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -83,18 +73,43 @@ export default defineComponent({
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ getButtonText(item) {
|
|
|
+ switch (+item.type) {
|
|
|
+ case 1:
|
|
|
+ return +item.need_apply ? 'Apply' : 'Nearby shops'
|
|
|
+ case 2:
|
|
|
+ return item.button_type === 'contact_us'
|
|
|
+ ? 'Contact us'
|
|
|
+ : item.button_type && item.button_name
|
|
|
+ case 4:
|
|
|
+ return +item.receive_method === 2 ? 'Nearby shops' : 'Send to me'
|
|
|
+ default:
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ },
|
|
|
onClickButton(right) {
|
|
|
- right.type === '1'
|
|
|
- ? this.$router.push(`/repaire/appointment?right_id=${right.id}`)
|
|
|
- : right.type === '2'
|
|
|
- ? (location.href = right.button_link)
|
|
|
- : this.$router.push({
|
|
|
- path: '/mailing',
|
|
|
- query: {
|
|
|
- right_id: right.id,
|
|
|
- right_name: right.title,
|
|
|
- },
|
|
|
- })
|
|
|
+ switch (+item.type) {
|
|
|
+ case 1:
|
|
|
+ return +item.need_apply
|
|
|
+ ? this.$router.push(`/repaire/appointment?right_id=${right.id}`)
|
|
|
+ : 'Nearby shops'
|
|
|
+ case 2:
|
|
|
+ return item.button_type === 'contact_us'
|
|
|
+ ? 'Contact us'
|
|
|
+ : item.button_type && (location.href = right.button_link)
|
|
|
+ case 4:
|
|
|
+ return +item.receive_method === 2
|
|
|
+ ? 'Nearby shops'
|
|
|
+ : this.$router.push({
|
|
|
+ path: '/mailing',
|
|
|
+ query: {
|
|
|
+ right_id: right.id,
|
|
|
+ right_name: right.title,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ default:
|
|
|
+ return ''
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
})
|