蒋科 1 kuukausi sitten
vanhempi
commit
965a948821
3 muutettua tiedostoa jossa 72 lisäystä ja 4 poistoa
  1. 4 0
      common/http.js
  2. 3 3
      components/BatteryInfo/BatteryInfo.vue
  3. 65 1
      pages/power-changer/index.vue

+ 4 - 0
common/http.js

@@ -225,4 +225,8 @@ export function vehicleBind(data) {
 //读取frid
 export function getEpc() {
 	return request.post("/vehicle/getEpc")
+}
+//冻结、解冻
+export function batteryfreeze(data) {
+  return request.post("/swap/freeze", data)
 }

+ 3 - 3
components/BatteryInfo/BatteryInfo.vue

@@ -199,9 +199,9 @@
 					text-indent: 5rpx;
 				}
 				image{
-					width: 18rpx;
-					height: 18rpx;
-					margin-top: 3rpx;
+					width: 26rpx;
+					height: 26rpx;
+					margin-top: 6rpx;
 					margin-right: 5rpx;
 				}
 			}

+ 65 - 1
pages/power-changer/index.vue

@@ -90,6 +90,10 @@
 							@click="ChangeModel(0)">自动选电</view>
 						<view class="leftBtn Rbtn" :class="[pamars.batChooseMode===1 ? 'active' : '']"
 							@click="ChangeModel(1)">手动选电</view>
+					</view>
+					<view class="freeze">
+					  <view class="active" @click="HandleFreeze(1)">冻结</view>
+					  <view @click="HandleFreeze(0)">解冻</view>
 					</view>
 				</view>
 			</view>
@@ -507,6 +511,45 @@
 						}
 					}
 				})
+			},
+			//冻结、解冻
+			HandleFreeze(isFree) {
+			  let that=this
+			  const text = isFree === 1 ? '冻结' : '解冻'
+			  if (this.BatterySelectAllArr.length !== 1 || this.BatterySelectAllArr[0].storeState!==1) {
+				this.ExchangeMessage('warn',`请选择一个电池进行${text}!`)
+			  }
+			  else if(isFree === 1 && this.BatterySelectAllArr[0].freezeState==1){
+				this.ExchangeMessage('warn',`选择电池已冻结,无需再次冻结!`)
+			  }
+			  else if(isFree === 0 && !this.BatterySelectAllArr[0].freezeState){
+				this.ExchangeMessage('warn',`选择电池已冻结,无需再次冻结!`)
+			  }
+			  else {
+				const pamars={
+				  code:this.BatterySelectAllArr[0].storeCode,
+				  type:isFree
+				}
+				uni.showModal({
+					title: `请确认${text}【${this.BatterySelectAllArr[0].storeCode}】号电池?`,
+					content: '',
+					success: function(res) {
+						if (res.confirm) {
+							that.$http.batteryfreeze(pamars).then(res => {
+								if (res.code === 0) {
+									that.clearStore()
+									that.ExchangeMessage('warn',isFree===1?'冻结成功':'解冻成功')
+								}else{
+									that.ExchangeMessage('warn',isFree===1?'冻结失败':'解冻失败')
+								}
+							})
+						} else if (res.cancel) {
+							return false
+							//用户点击取消按钮触发
+						}
+					}
+				})
+			  }
 			},
 			//开始换电
 			BeginChangePower() {
@@ -1197,7 +1240,28 @@
 				padding-top: 5px;
 				font-weight: 600;
 			}
-
+			.freeze{
+				margin-left: auto;
+				display: flex;
+				view{
+					padding: 3px 0;
+					width: 48px;
+					text-align: center;
+					background: #263042;
+					font-weight: 400;
+					color: #FFFFFF;
+					font-size: 14px;
+					height: 24px;
+					box-sizing: border-box;
+					line-height: 18px;
+					border-radius: 2px;
+					margin-right: 12px;
+				}
+				.active{
+					background: #91FDB9;
+					color: #000000;
+				}
+			}
 			.switch {
 				margin-left: auto;
 				color: white;