@@ -32,6 +32,7 @@ const formModel = ref({
3232 costPrice: 0.000 ,
3333 volume: 0 ,
3434 alarm: 0 ,
35+ alarmPrice: 0 ,
3536})
3637
3738const data = reactive ({
@@ -203,7 +204,7 @@ async function monitor() {
203204 }else if (result .profitAmount < 0 ){
204205 result .profitType = " success"
205206 }
206- if (res[0 ].AlarmChangePercent > 0 && Math .abs (roundedNum)> res[0 ].AlarmChangePercent ){
207+ if (( res[0 ].AlarmChangePercent > 0 && Math .abs (roundedNum)> res[0 ].AlarmChangePercent ) || (res[ 0 ]. AlarmPrice > 0 && result[ " 当前价格 " ] > res[ 0 ]. AlarmPrice ) ){
207208 SendMessage (result)
208209 }
209210 }
@@ -236,6 +237,7 @@ function setStock(code,name){
236237 formModel .value .volume = res[0 ].Volume
237238 formModel .value .costPrice = res[0 ].CostPrice
238239 formModel .value .alarm = res[0 ].AlarmChangePercent
240+ formModel .value .alarmPrice = res[0 ].AlarmPrice
239241 modalShow .value = true
240242}
241243
@@ -253,10 +255,9 @@ function showK(code,name){
253255}
254256
255257
256- function updateCostPriceAndVolumeNew (code ,price ,volume ,alarm ){
257- console .log (code,price,volume)
258- if (alarm){
259- SetAlarmChangePercent (alarm,code).then (result => {
258+ function updateCostPriceAndVolumeNew (code ,price ,volume ,alarm ,formModel ){
259+ if (alarm|| formModel .alarmPrice ){
260+ SetAlarmChangePercent (alarm,formModel .alarmPrice ,code).then (result => {
260261 // message.success(result)
261262 })
262263 }
@@ -383,7 +384,7 @@ function SendMessage(result){
383384 <n-form-item label =" 股票成本" path =" costPrice" >
384385 <n-input-number v-model:value =" formModel.costPrice" min =" 0" placeholder =" 请输入股票成本" >
385386 <template #suffix >
386- 元
387+ ¥
387388 </template >
388389 </n-input-number >
389390 </n-form-item >
@@ -401,9 +402,17 @@ function SendMessage(result){
401402 </template >
402403 </n-input-number >
403404 </n-form-item >
405+ <n-form-item label =" 股价提醒" path =" alarmPrice" >
406+ <n-input-number v-model:value =" formModel.alarmPrice" min =" 0" placeholder =" 请输入股价报警值(¥)" >
407+ <template #suffix >
408+ ¥
409+ </template >
410+ </n-input-number >
411+ </n-form-item >
412+
404413 </n-form >
405414 <template #footer >
406- <n-button type =" primary" @click =" updateCostPriceAndVolumeNew(formModel.code,formModel.costPrice,formModel.volume,formModel.alarm)" >保存</n-button >
415+ <n-button type =" primary" @click =" updateCostPriceAndVolumeNew(formModel.code,formModel.costPrice,formModel.volume,formModel.alarm,formModel )" >保存</n-button >
407416 </template >
408417 </n-modal >
409418
0 commit comments