Files
crm-uni/pages/customer/followsuccess.vue
T
2025-06-09 17:58:22 +08:00

200 lines
4.8 KiB
Vue

<template>
<view>
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" :title="$t('subsuccess')"></uni-nav-bar>
<view class="contents">
<image src="/static/image/customer/success.png" mode=""></image>
<view class="">{{$t('subsuccess')}}</view>
</view>
<u-gap height="10" bgColor="#F6F6F6"></u-gap>
<view class="cont">
<view>{{$t('nexttime')}}</view>
<view class="coll">
<u-row justify="space-between" gutter="10">
<u-col span="4">
<view class="item" :class="{ active: actives=='1' }" @click="active('1')">
{{$t('onedaygj')}}
</view>
</u-col>
<u-col span="4">
<view class="item" :class="{ active: actives=='3' }" @click="active('3')">
{{$t('threedaygj')}}
</view>
</u-col>
<u-col span="4">
<view class="item" :class="{ active: actives=='7' }" @click="active('7')">
{{$t('sevendaygj')}}
</view>
</u-col>
</u-row>
</view>
<view class="coll">
<view class="item" :class="{ active: actives=='auto' }" @click="active('auto')">
{{time || $t('autodaygj')}}
</view>
</view>
</view>
<view class="">
<button class="btn" @click="nextFn">{{$t('submit')}}</button>
</view>
<u-datetime-picker
:show="shownexttime"
closeOnClickOverlay
v-model="nexttime"
mode="datetime"
:cancel-text="$t('cancel')"
:confirm-text="$t('confirm')"
@confirm="confirmnext"
@cancel="cancelnext"
@close="close('shownexttime')"
></u-datetime-picker>
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
export default {
data() {
return {
id:'',
actives:'',
time:'',
shownexttime:false,
nexttime: Number(new Date()),
}
},
onLoad(options) {
this.id = options.id;
},
methods: {
leftClick(){
uni.navigateBack({})
},
active(item){
if(item=='auto'){
this.shownexttime = true
}
this.actives = item
},
result(time, mode) {
const timeFormat = uni.$u.timeFormat
switch (mode) {
case 'datetime':
return timeFormat(time, 'yyyy-mm-dd hh:MM')
case 'date':
return timeFormat(time, 'yyyy-mm-dd')
case 'year-month':
return timeFormat(time, 'yyyy-mm')
case 'time':
return time
default:
return ''
}
},
cancelnext() {
this.shownexttime = false
},
confirmnext(e) {
this.shownexttime = false
this.nexttime = e.value
this.time = this.result(e.value, e.mode)
},
getLaterDate(dayNum, dateTime = null) {
// 如果为null,则格式化当前时间为时间戳
if (!dateTime) dateTime = +new Date();
// 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
if (dateTime.toString().length == 10) dateTime *= 1000;
const timestamp = +new Date(Number(dateTime));
const one_day = 86400000; // 24 * 60 * 60 * 1000;
const addVal = dayNum * one_day + timestamp;
//x天后的日期
const date = new Date(addVal);
//格式化日期
const filters = n => {
return n < 10 ? (n = '0' + n) : n;
};
const month = filters(date.getMonth() + 1);
const day = filters(date.getDate());
const hours = filters(date.getHours());
const minutes = filters(date.getMinutes());
const seconds = filters(date.getSeconds());
const lastTime = `${date.getFullYear()}/${month}/${day} ${hours}:${minutes}:${seconds}`;
// console.log(lastTime)
return addVal;
},
nextFn(){
var nexttime=this.nexttime;
if(this.actives==1){
nexttime = this.getLaterDate(1)
}
if(this.actives==3){
nexttime = this.getLaterDate(3)
}
if(this.actives==7){
nexttime = this.getLaterDate(7)
}
request({
url:'customer/followNext',
method:'post',
data:{
id:this.id,
follow_next:nexttime/1000
}
}).then(res => {
uni.showToast({
title: res.data.message,
icon: 'none'
});
if(res.data.code ==0){
setTimeout(() => {
uni.reLaunch({
url: '/pages/index/customer',// 替换为你要跳转的页面路径
});
}, 1000);
}
})
},
}
}
</script>
<style lang="scss">
.contents{
text-align: center;
padding-bottom: 15px;
image{
margin-top: 20px;
width:392rpx;
height:308rpx;
}
}
.cont{
padding: 15px;
}
.active{
color: white !important;
background: linear-gradient(to right, #3471FF, #6776FF) !important;
}
.coll{
margin-top: 10px;
.item{
background: #ECF2FF;
color: #3471FF;
border-radius: 8px;
padding:10px 0px;
text-align: center;
}
}
.btn{
background: linear-gradient(to right, #3471FF, #6776FF);
color: white;
border-radius: 8px;
width: 92%;
margin-bottom: 40px;
margin: 15px 4%;
}
</style>