| | |
| | | <template> |
| | | <view class="account-detail"> |
| | | <!-- 顶部标题栏 --> |
| | | <view class="header"> |
| | | <up-icon name="arrow-left" size="20" color="#333" @click="goBack" /> |
| | | <text class="title">台账详情</text> |
| | | </view> |
| | | <!-- 使用通用页面头部组件 --> |
| | | <PageHeader title="台账详情" @back="goBack" /> |
| | | |
| | | <!-- 表单区域 --> |
| | | <van-form @submit="onSubmit" label-width="110px" input-align="right" style="margin-top: 10px" error-message-align="right" scroll-to-error scroll-to-error-position="center"> |
| | |
| | | </van-popup> |
| | | <van-field label="付款方式" name="paymentMethod" borderBottom="true" v-model="form.paymentMethod" placeholder="请输入付款方式"> |
| | | </van-field> |
| | | <van-field label="录入人" name="entryPersonName" borderBottom="true" v-model="form.entryPersonName" placeholder="请输入" readonly> |
| | | <van-field label="录入人" name="entryPersonName" borderBottom="true" v-model="form.entryPersonName" placeholder="请输入" disabled> |
| | | </van-field> |
| | | <van-field label="录入日期" name="entryDate" borderBottom="true" v-model="form.entryDate" placeholder="请输入" readonly> |
| | | <van-field label="录入日期" name="entryDate" borderBottom="true" v-model="form.entryDate" placeholder="请输入" disabled> |
| | | </van-field> |
| | | <van-popup v-model:show="showPicker" destroy-on-close position="bottom"> |
| | | <van-picker |
| | |
| | | <view class="product-section"> |
| | | <view class="section-header"> |
| | | <text class="section-title">产品信息</text> |
| | | <van-button type="primary" size="small" @click="addProduct" class="add-btn" icon="plus">新增</van-button> |
| | | <van-button type="primary" size="small" @click="addProduct" class="add-btn" icon="plus" v-if="operationType !== 'view'">新增</van-button> |
| | | </view> |
| | | <view class="product-card" v-for="(product, idx) in productData" :key="idx"> |
| | | <!-- 产品类 --> |
| | |
| | | <text class="product-productCategory">产品 {{ idx + 1 }}</text> |
| | | </view> |
| | | <!-- 操作按钮 --> |
| | | <view class="product-actions"> |
| | | <view class="product-actions" v-if="operationType !== 'view'"> |
| | | <van-button type="danger" size="mini" @click="removeProduct(idx)" class="del-btn" icon="delete">删除</van-button> |
| | | </view> |
| | | </view> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="footer-btns"> |
| | | <view class="footer-btns" v-if="operationType !== 'view'"> |
| | | <van-button class="cancel-btn" @click="goBack">取消</van-button> |
| | | <van-button class="save-btn" native-type="submit" form-type="submit">保存</van-button> |
| | | </view> |
| | |
| | | ]); |
| | | |
| | | const addProduct = () => { |
| | | if (productData.value === null) { |
| | | productData.value = [] |
| | | } |
| | | productData.value.push({ |
| | | productCategory: '', |
| | | specificationModel: '', |
| | |
| | | modelList({ id: value }).then((res) => { |
| | | modelOptions.value = res.map(user => ({ |
| | | text: user.model, |
| | | value: user.id |
| | | value: user.id, |
| | | unit: user.unit, |
| | | })); |
| | | }); |
| | | }; |
| | |
| | | title: '请添加产品信息', |
| | | icon: 'none' |
| | | }); |
| | | return |
| | | } |
| | | form.value.type = 1; |
| | | addOrUpdateSalesLedger(form.value).then((res) => { |
| | |
| | | }; |
| | | const setUserInfo = () => { |
| | | form.value.entryPerson = userStore.id; |
| | | form.value.entryPersonName = userStore.name; |
| | | form.value.entryPersonName = userStore.nickName; |
| | | // 设置当天日期 |
| | | const today = new Date() |
| | | const year = today.getFullYear() |
| | |
| | | try { |
| | | editData.value = JSON.parse(editDataStr); |
| | | // 如果是编辑模式,等待数据加载完成后填充表单数据 |
| | | if (operationType.value === 'edit' && editData.value) { |
| | | if (operationType.value !== 'add' && editData.value) { |
| | | // 使用 nextTick 确保数据加载完成后再填充 |
| | | setTimeout(() => { |
| | | fillFormData(); |
| | |
| | | font-weight: 600; |
| | | color: #333; |
| | | } |
| | | .add-btn { |
| | | border-radius: 0.25rem; |
| | | } |
| | | .product-card { |
| | | background: #FFFFFF; |
| | | box-shadow: 0 0 1.25rem 0 rgba(0,57,117,0.08); |
| | |
| | | } |
| | | .product-form { |
| | | margin-bottom: 1rem; |
| | | } |
| | | .del-btn { |
| | | border-radius: 0.25rem; |
| | | } |
| | | .footer-btns { |
| | | position: fixed; |