shangfutong-ui/jeepay-ui-uapp-merchant/pageDevice/editPage/editPage.vue

75 lines
2.0 KiB
Vue

<template>
<view class="edit-wrapper">
<view class="edit-input flex-center">
<uni-easyinput :inputBorder="false" clearable v-model="params.info" type="text" :styles="styles" />
</view>
<view class="tips" v-if="params.tips">修改设备编号,将有可能导致已报备渠道无法使用</view>
<view class="confirm-button flex-center" hover-class="touch-button" @tap="updateState">确认修改</view>
</view>
</template>
<script setup>
import { reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { reqLoad, API_URL_MCH_APP_LIST, API_URL_SYS_DEVICE_LIST } from '@/http/apiManager.js'
import infoBox from '@/commons/utils/infoBox.js'
import emit from '@/commons/utils/emit.js'
import go from '@/commons/utils/go.js'
onLoad((options) => {
console.log('options', options)
uni.setNavigationBarTitle({
title: '修改' + options.navTitle,
})
Object.assign(params, options)
})
const styles = reactive({
backgroundColor: 'transparent',
color: '#000',
fontSize: '32rpx',
})
const params = reactive({})
const apiObf = {
app: API_URL_MCH_APP_LIST,
horn: API_URL_SYS_DEVICE_LIST,
}
function updateState() {
const data = {}
data[params.field] = params.info
if (!data[params.field]) return infoBox.showToast('修改内容不能为空')
return reqLoad.updateById(apiObf[params.api], params.id, data).then(() => {
emit.pageEmit(emit.ENAME_REF_TABLE_MCH_APP) // 修改列表页面。
infoBox.showSuccessToast('修改成功')
go.back(1, emit.ENAME_REF_TABLE_MCH_APP_DETAILS)
})
}
</script>
<style lang="scss" scoped>
.edit-input {
padding: 0 20rpx;
margin: 0 35rpx;
margin-top: 150rpx;
height: 120rpx;
border-radius: 32rpx;
background-color: #f7f7f7;
}
.tips {
margin-top: 30rpx;
text-align: center;
font-size: 27rpx;
color: #808080;
}
.confirm-button {
margin: 0 auto;
margin-top: 90rpx;
width: 400rpx;
height: 110rpx;
border-radius: 20rpx;
font-size: 33rpx;
font-weight: 500;
color: #fff;
background: $jeepay-bg-primary;
}
</style>