|
@@ -6,13 +6,13 @@
|
|
|
<div class="type-buttons">
|
|
<div class="type-buttons">
|
|
|
<button
|
|
<button
|
|
|
class="birthday-type-btn"
|
|
class="birthday-type-btn"
|
|
|
- :class="{active: birthdayType == 0}"
|
|
|
|
|
- @click="birthdayType = 0"
|
|
|
|
|
|
|
+ :class="{active: lunar == 0}"
|
|
|
|
|
+ @click="lunar = 0"
|
|
|
>公历</button>
|
|
>公历</button>
|
|
|
<button
|
|
<button
|
|
|
class="birthday-type-btn"
|
|
class="birthday-type-btn"
|
|
|
- :class="{active: birthdayType == 1}"
|
|
|
|
|
- @click="birthdayType = 1"
|
|
|
|
|
|
|
+ :class="{active: lunar == 1}"
|
|
|
|
|
+ @click="lunar = 1"
|
|
|
>农历</button>
|
|
>农历</button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -69,7 +69,6 @@
|
|
|
|
|
|
|
|
<!-- 操作按钮 -->
|
|
<!-- 操作按钮 -->
|
|
|
<div class="birthday-actions">
|
|
<div class="birthday-actions">
|
|
|
- <button class="birthday-action-btn cancel-btn" @click="cancelBirthday">取消</button>
|
|
|
|
|
<button class="birthday-action-btn save-btn" @click="saveBirthday">保存</button>
|
|
<button class="birthday-action-btn save-btn" @click="saveBirthday">保存</button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -88,22 +87,14 @@ export default {
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- birthdayType: 0, // 0公历 1农历
|
|
|
|
|
- birthdayMonth: new Date().getMonth() + 1, // 默认当前月份
|
|
|
|
|
- birthdayDate: new Date().getDate(), // 默认当前日期
|
|
|
|
|
|
|
+ lunar: 0, // 0公历 1农历
|
|
|
|
|
+ birthdayMonth:1, // 默认当前月份
|
|
|
|
|
+ birthdayDate:1, // 默认当前日期
|
|
|
dateArray: [], // 日期数组
|
|
dateArray: [], // 日期数组
|
|
|
- originalBirthday: {}, // 原始生日信息,用于取消操作
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
- customId: {
|
|
|
|
|
- immediate: true,
|
|
|
|
|
- handler(val) {
|
|
|
|
|
- if (val) {
|
|
|
|
|
- this.getCustomBirthday()
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
// 初始化日期数组为1-31
|
|
// 初始化日期数组为1-31
|
|
@@ -111,40 +102,9 @@ export default {
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
showBirth(info){
|
|
showBirth(info){
|
|
|
- console.log(info)
|
|
|
|
|
- },
|
|
|
|
|
- // 获取客户生日信息
|
|
|
|
|
- getCustomBirthday() {
|
|
|
|
|
- if (!this.customId) {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '请先选择客户',
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 这里应该调用API获取客户生日信息
|
|
|
|
|
- this.$api.member.getCustomDetail({id: this.customId}).then(res => {
|
|
|
|
|
- if (res.code === 0) {
|
|
|
|
|
- const data = res.data
|
|
|
|
|
- // 保存原始生日信息,用于取消操作
|
|
|
|
|
- this.originalBirthday = {
|
|
|
|
|
- type: data.birthdayType || 0,
|
|
|
|
|
- month: data.birthdayMonth || 1,
|
|
|
|
|
- date: data.birthdayDate || 1
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- this.birthdayType = data.birthdayType || 0
|
|
|
|
|
- this.birthdayMonth = data.birthdayMonth || 1
|
|
|
|
|
- this.birthdayDate = data.birthdayDate || 1
|
|
|
|
|
- this.updateDateArray()
|
|
|
|
|
- }
|
|
|
|
|
- }).catch(err => {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '获取客户信息失败',
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ this.birthdayMonth = info.birthdayMonth
|
|
|
|
|
+ this.birthdayDate = info.birthdayDate
|
|
|
|
|
+ this.lunar = info.lunar
|
|
|
},
|
|
},
|
|
|
// 更新日期数组
|
|
// 更新日期数组
|
|
|
updateDateArray() {
|
|
updateDateArray() {
|
|
@@ -152,28 +112,19 @@ export default {
|
|
|
this.dateArray = Array.from({length: 31}, (_, i) => i + 1)
|
|
this.dateArray = Array.from({length: 31}, (_, i) => i + 1)
|
|
|
},
|
|
},
|
|
|
// 保存生日信息
|
|
// 保存生日信息
|
|
|
- saveBirthday() {
|
|
|
|
|
- if (!this.customId) return
|
|
|
|
|
-
|
|
|
|
|
|
|
+ saveBirthday() {
|
|
|
const params = {
|
|
const params = {
|
|
|
customId: this.customId,
|
|
customId: this.customId,
|
|
|
- birthdayType: this.birthdayType,
|
|
|
|
|
|
|
+ lunar: this.lunar,
|
|
|
birthdayMonth: this.birthdayMonth,
|
|
birthdayMonth: this.birthdayMonth,
|
|
|
birthdayDate: this.birthdayDate
|
|
birthdayDate: this.birthdayDate
|
|
|
}
|
|
}
|
|
|
modifyBirthday(params).then(res=>{
|
|
modifyBirthday(params).then(res=>{
|
|
|
if(res.code == 1){
|
|
if(res.code == 1){
|
|
|
|
|
+ this.$emit('refreshCustomInfo',this.customId)
|
|
|
this.$msg('修改成功')
|
|
this.$msg('修改成功')
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- },
|
|
|
|
|
- // 取消修改
|
|
|
|
|
- cancelBirthday() {
|
|
|
|
|
- // 恢复原始值
|
|
|
|
|
- this.birthdayType = this.originalBirthday.type
|
|
|
|
|
- this.birthdayMonth = this.originalBirthday.month
|
|
|
|
|
- this.birthdayDate = this.originalBirthday.date
|
|
|
|
|
- this.$emit('cancel')
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|