| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005 |
- <template>
- <view class="page">
- <NavBar :title="pageTitle" :showBack="true" />
- <scroll-view class="form-scroll" scroll-y>
- <view class="form-section">
- <view class="section-title">
- <text class="section-title-text">基本信息</text>
- </view>
- <view class="form-item required">
- <text class="form-label">商品名称</text>
- <view class="form-input-wrap">
- <input
- class="form-input"
- v-model="formData.productName"
- placeholder="请输入商品名称"
- :maxlength="50"
- :disabled="isView"
- />
- </view>
- </view>
- <view class="form-item required">
- <text class="form-label">条形码</text>
- <view class="form-input-wrap">
- <input
- class="form-input"
- v-model="formData.barcode"
- placeholder="请输入条形码"
- :maxlength="30"
- :disabled="isView"
- @blur="onBarcodeBlur"
- />
- <view v-if="!isView" class="scan-btn" @click="scanBarcode">
- <view class="scan-icon"></view>
- </view>
- </view>
- <text v-if="barcodeWarning" class="form-warning">该条码已存在商品库中</text>
- </view>
- <view class="form-item">
- <text class="form-label">分类</text>
- <view class="form-input-wrap">
- <input
- class="form-input"
- v-model="formData.category"
- placeholder="请输入分类"
- :maxlength="20"
- :disabled="isView"
- />
- </view>
- </view>
- <view class="form-item">
- <text class="form-label">品牌</text>
- <view class="form-input-wrap">
- <input
- class="form-input"
- v-model="formData.brand"
- placeholder="请输入品牌"
- :maxlength="30"
- :disabled="isView"
- />
- </view>
- </view>
- <view class="form-item">
- <text class="form-label">规格</text>
- <view class="form-input-wrap">
- <input
- class="form-input"
- v-model="formData.specification"
- placeholder="请输入规格"
- :maxlength="30"
- :disabled="isView"
- />
- </view>
- </view>
- <view class="form-item">
- <text class="form-label">单位</text>
- <view class="form-input-wrap">
- <input
- class="form-input"
- v-model="formData.unit"
- placeholder="请输入单位"
- :maxlength="10"
- :disabled="isView"
- />
- </view>
- </view>
- </view>
- <view class="form-section">
- <view class="section-title">
- <text class="section-title-text">价格信息</text>
- </view>
- <view class="form-item">
- <text class="form-label">售价(元)</text>
- <view class="form-input-wrap">
- <input
- class="form-input"
- type="digit"
- :value="priceInputs.price"
- placeholder="请输入售价"
- :disabled="isView"
- @input="onPriceInput('price', $event)"
- @blur="onPriceBlur('price')"
- />
- </view>
- </view>
- <view class="form-item">
- <text class="form-label">成本价(元)</text>
- <view class="form-input-wrap">
- <input
- class="form-input"
- type="digit"
- :value="priceInputs.costPrice"
- placeholder="请输入成本价"
- :disabled="isView"
- @input="onPriceInput('costPrice', $event)"
- @blur="onPriceBlur('costPrice')"
- />
- </view>
- </view>
- </view>
- <view class="form-section">
- <view class="section-title">
- <text class="section-title-text">加工图(5张,按顺序上传)</text>
- </view>
- <view class="image-upload-area">
- <view class="labeled-image-list">
- <view class="labeled-image-item" v-for="(item, index) in processedImageSlots" :key="'p'+index">
- <text class="labeled-image-title">{{ item.label }}</text>
- <view class="label-image-wrap">
- <image
- v-if="item.url"
- class="upload-image"
- :src="item.url"
- mode="aspectFill"
- @click="previewLabeledImage(item.url)"
- />
- <view v-else-if="!isView" class="image-add" @click="chooseLabeledImage(index, 'processed')">
- <text class="add-icon">+</text>
- </view>
- </view>
- <view v-if="!isView && item.url" class="label-image-delete" @click="removeLabeledImage(index, 'processed')">
- <text class="delete-icon">×</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="form-section">
- <view class="section-title">
- <text class="section-title-text">原图(4张,按顺序上传)</text>
- </view>
- <view class="image-upload-area">
- <view class="labeled-image-list">
- <view class="labeled-image-item" v-for="(item, index) in originalImageSlots" :key="'o'+index">
- <text class="labeled-image-title">{{ item.label }}</text>
- <view class="label-image-wrap">
- <image
- v-if="item.url"
- class="upload-image"
- :src="item.url"
- mode="aspectFill"
- @click="previewLabeledImage(item.url)"
- />
- <view v-else-if="!isView" class="image-add" @click="chooseLabeledImage(index, 'original')">
- <text class="add-icon">+</text>
- </view>
- </view>
- <view v-if="!isView && item.url" class="label-image-delete" @click="removeLabeledImage(index, 'original')">
- <text class="delete-icon">×</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 货道参数 -->
- <view class="form-section">
- <view class="section-title">
- <text class="section-title-text">货道参数</text>
- </view>
- <view class="form-row">
- <view class="form-item form-item-half">
- <text class="form-label">长度(mm)</text>
- <view class="form-input-wrap">
- <input class="form-input" type="number" v-model.number="formData.length" placeholder="长度" :disabled="isView" />
- </view>
- </view>
- <view class="form-item form-item-half">
- <text class="form-label">宽度(mm)</text>
- <view class="form-input-wrap">
- <input class="form-input" type="number" v-model.number="formData.width" placeholder="宽度" :disabled="isView" />
- </view>
- </view>
- </view>
- <view class="form-row">
- <view class="form-item form-item-half">
- <text class="form-label">高度(mm)</text>
- <view class="form-input-wrap">
- <input class="form-input" type="number" v-model.number="formData.height" placeholder="高度" :disabled="isView" />
- </view>
- </view>
- <view class="form-item form-item-half">
- <text class="form-label">陈列高度(mm)</text>
- <view class="form-input-wrap">
- <input class="form-input" type="number" v-model.number="formData.exhibitHeight" placeholder="陈列高度" :disabled="isView" />
- </view>
- </view>
- </view>
- <view class="form-row">
- <view class="form-item form-item-half">
- <text class="form-label">商品占列</text>
- <view class="form-input-wrap">
- <input class="form-input" type="number" v-model.number="formData.columns" placeholder="占列数" :disabled="isView" />
- </view>
- </view>
- <view class="form-item form-item-half">
- <text class="form-label">每货道数量</text>
- <view class="form-input-wrap">
- <input class="form-input" type="number" v-model.number="formData.numbers" placeholder="数量" :disabled="isView" />
- </view>
- </view>
- </view>
- </view>
- <!-- 其他信息 -->
- <view class="form-section">
- <view class="section-title">
- <text class="section-title-text">其他信息</text>
- </view>
- <view class="form-item">
- <text class="form-label">商品类型</text>
- <view class="form-input-wrap">
- <picker :range="productTypeOptions" :range-key="'label'" :value="formData.productType || 0" @change="onProductTypeChange" :disabled="isView">
- <text class="picker-value" :class="{ 'picker-placeholder': formData.productType === undefined }">
- {{ productTypeLabel }}
- </text>
- </picker>
- </view>
- </view>
- <view class="form-item">
- <text class="form-label">标品/非标品</text>
- <view class="form-input-wrap">
- <picker :range="standardOptions" :range-key="'label'" :value="formData.standard ? formData.standard - 1 : 0" @change="onStandardChange" :disabled="isView">
- <text class="picker-value" :class="{ 'picker-placeholder': formData.standard === undefined }">
- {{ standardLabel }}
- </text>
- </picker>
- </view>
- </view>
- <view class="form-item">
- <text class="form-label">学习机号</text>
- <view class="form-input-wrap">
- <input class="form-input" v-model="formData.stickerNum" placeholder="请输入学习机号" :maxlength="20" :disabled="isView" />
- </view>
- </view>
- <view class="form-item textarea-item">
- <text class="form-label">申请原因</text>
- <textarea
- class="form-textarea"
- v-model="formData.reason"
- placeholder="请输入申请原因"
- :maxlength="500"
- :disabled="isView"
- auto-height
- :style="{ minHeight: '120rpx' }"
- />
- <text v-if="!isView" class="char-count">{{ (formData.reason || '').length }}/500</text>
- </view>
- </view>
- <view class="form-section">
- <view class="section-title">
- <text class="section-title-text">商品描述</text>
- </view>
- <view class="form-item textarea-item">
- <textarea
- class="form-textarea"
- v-model="formData.description"
- placeholder="请输入商品描述"
- :maxlength="500"
- :disabled="isView"
- auto-height
- :style="{ minHeight: '160rpx' }"
- />
- <text v-if="!isView" class="char-count">{{ (formData.description || '').length }}/500</text>
- </view>
- </view>
- <view class="bottom-spacer"></view>
- </scroll-view>
- <view class="footer-bar" v-if="!isView">
- <view class="btn-draft" @click="handleSaveDraft" v-if="!isEdit">
- <text class="btn-draft-text">存草稿</text>
- </view>
- <view class="btn-submit" @click="handleSubmit">
- <text class="btn-submit-text">{{ isEdit ? '保存修改' : '提交申请' }}</text>
- </view>
- </view>
- </view>
- </template>
- <script setup lang="ts">
- import { ref, reactive, computed, onMounted } from 'vue';
- import NavBar from '@/components/NavBar.vue';
- import {
- getNewProductApplyById,
- submitNewProductApply,
- saveNewProductApplyDraft,
- updateNewProductApply,
- checkBarcode,
- type NewProductApplyItem
- } from '@/api/newProductApply';
- import { showToast } from '@/utils/common';
- import { UPLOAD_URL, IMAGE_BASE_URL } from '@/utils/config';
- type PageMode = 'add' | 'edit' | 'view';
- const mode = ref<PageMode>('add');
- const editId = ref<number>(0);
- const barcodeWarning = ref(false);
- // 商品类型选项
- const productTypeOptions = [{ label: '静态', value: 0 }, { label: '动态', value: 1 }];
- const standardOptions = [{ label: '标品', value: 1 }, { label: '非标品', value: 2 }];
- const productTypeLabel = computed(() => {
- const opt = productTypeOptions.find(o => o.value === formData.productType);
- return opt ? opt.label : '请选择商品类型';
- });
- const standardLabel = computed(() => {
- const opt = standardOptions.find(o => o.value === formData.standard);
- return opt ? opt.label : '请选择';
- });
- // 9张分类图片 slots
- const processedLabels = ['正面图', '背面图', '侧面图', '顶部图', '称重图'];
- const originalLabels = ['正面原图', '背面原图', '侧面原图', '顶部原图'];
- const processedImageSlots = ref(processedLabels.map(label => ({ label, url: '' })));
- const originalImageSlots = ref(originalLabels.map(label => ({ label, url: '' })));
- const isEdit = computed(() => mode.value === 'edit');
- const isView = computed(() => mode.value === 'view');
- const pageTitle = computed(() => {
- if (isView.value) return '查看申请';
- if (isEdit.value) return '编辑申请';
- return '新品申请';
- });
- const formData = reactive<NewProductApplyItem>({
- productName: '',
- barcode: '',
- category: '',
- brand: '',
- specification: '',
- unit: '',
- price: 0,
- costPrice: 0,
- images: '',
- description: '',
- productType: 0,
- standard: 1,
- stickerNum: '',
- length: undefined,
- width: undefined,
- height: undefined,
- exhibitHeight: undefined,
- columns: undefined,
- numbers: undefined,
- reason: ''
- });
- const validate = (): string | null => {
- if (!formData.productName.trim()) {
- return '请输入商品名称';
- }
- if (!formData.barcode.trim()) {
- return '请输入条形码';
- }
- return null;
- };
- const priceInputs = reactive({ price: '', costPrice: '' });
- const initPriceInputs = () => {
- priceInputs.price = formData.price ? String(formData.price) : '';
- priceInputs.costPrice = formData.costPrice ? String(formData.costPrice) : '';
- };
- const onPriceInput = (field: 'price' | 'costPrice', e: any) => {
- let val = e.detail.value;
- val = val.replace(/[^\d.]/g, '');
- if (val.startsWith('.')) val = '0' + val;
- const parts = val.split('.');
- if (parts.length > 1) {
- val = parts[0] + '.' + parts.slice(1).join('').slice(0, 2);
- }
- if (parts.length > 2) {
- val = parts[0] + '.' + parts[1];
- }
- priceInputs[field] = val;
- };
- const onPriceBlur = (field: 'price' | 'costPrice') => {
- const val = parseFloat(priceInputs[field]);
- formData[field] = isNaN(val) ? 0 : Math.max(0, parseFloat(val.toFixed(2)));
- priceInputs[field] = formData[field] ? String(formData[field]) : '';
- };
- const scanBarcode = () => {
- uni.scanCode({
- scanType: ['barCode'],
- success: (res) => {
- if (res.result) {
- formData.barcode = res.result;
- onBarcodeBlur();
- }
- },
- fail: () => {
- showToast('扫码取消或失败');
- }
- });
- };
- const onBarcodeBlur = async () => {
- if (!formData.barcode.trim()) {
- barcodeWarning.value = false;
- return;
- }
- try {
- const res = await checkBarcode(formData.barcode.trim());
- if (res && res.exists) {
- barcodeWarning.value = true;
- if (res.product) {
- formData.productName = res.product.productName || formData.productName;
- formData.category = res.product.category || formData.category;
- formData.brand = res.product.brand || formData.brand;
- formData.specification = res.product.specification || formData.specification;
- formData.unit = res.product.unit || formData.unit;
- formData.price = res.product.price || formData.price;
- }
- } else {
- barcodeWarning.value = false;
- }
- } catch (error) {
- barcodeWarning.value = false;
- }
- };
- const onProductTypeChange = (e: any) => {
- formData.productType = productTypeOptions[e.detail.value].value;
- };
- const onStandardChange = (e: any) => {
- formData.standard = standardOptions[e.detail.value].value;
- };
- // 分类图片上传
- const chooseLabeledImage = (index: number, type: 'processed' | 'original') => {
- uni.chooseImage({
- count: 1,
- sizeType: ['compressed'],
- sourceType: ['album', 'camera'],
- success: async (res) => {
- const tempPath = res.tempFilePaths[0];
- try {
- const uploadedUrl = await uploadImage(tempPath);
- if (type === 'processed') {
- processedImageSlots.value[index].url = uploadedUrl;
- } else {
- originalImageSlots.value[index].url = uploadedUrl;
- }
- syncImagesToForm();
- } catch (error) {
- console.error('上传图片失败', error);
- }
- }
- });
- };
- const removeLabeledImage = (index: number, type: 'processed' | 'original') => {
- if (type === 'processed') {
- processedImageSlots.value[index].url = '';
- } else {
- originalImageSlots.value[index].url = '';
- }
- syncImagesToForm();
- };
- const previewLabeledImage = (url: string) => {
- uni.previewImage({
- current: url.startsWith('http') ? url : `${IMAGE_BASE_URL}${url}`,
- urls: [url.startsWith('http') ? url : `${IMAGE_BASE_URL}${url}`]
- });
- };
- const syncImagesToForm = () => {
- const allUrls = [
- ...processedImageSlots.value.map(s => s.url),
- ...originalImageSlots.value.map(s => s.url)
- ];
- formData.images = allUrls.join(',');
- };
- const uploadImage = (tempFilePath: string): Promise<string> => {
- return new Promise((resolve, reject) => {
- uni.uploadFile({
- url: UPLOAD_URL,
- filePath: tempFilePath,
- name: 'file',
- success: (uploadRes) => {
- try {
- const data = JSON.parse(uploadRes.data);
- if (data.code === 200 && data.data) {
- const url = data.data.url || data.data;
- resolve(url.startsWith('http') ? url : `${IMAGE_BASE_URL}${url}`);
- } else {
- reject(new Error(data.message || '上传失败'));
- }
- } catch {
- reject(new Error('解析上传结果失败'));
- }
- },
- fail: (err) => {
- reject(err);
- }
- });
- });
- };
- const handleSaveDraft = async () => {
- const error = validate();
- if (error) {
- showToast(error);
- return;
- }
- try {
- uni.showLoading({ title: '保存中...', mask: true });
- await saveNewProductApplyDraft(formData);
- uni.hideLoading();
- showToast('草稿保存成功', 'success');
- setTimeout(() => {
- uni.navigateBack();
- }, 500);
- } catch (error) {
- uni.hideLoading();
- console.error('保存草稿失败', error);
- }
- };
- const handleSubmit = async () => {
- const error = validate();
- if (error) {
- showToast(error);
- return;
- }
- try {
- uni.showLoading({ title: '提交中...', mask: true });
- if (isEdit.value) {
- await updateNewProductApply(editId.value, formData);
- showToast('修改成功', 'success');
- } else {
- await submitNewProductApply(formData);
- showToast('提交成功', 'success');
- }
- uni.hideLoading();
- setTimeout(() => {
- uni.navigateBack();
- }, 500);
- } catch (error) {
- uni.hideLoading();
- console.error('提交失败', error);
- }
- };
- const loadDetail = async (id: number) => {
- try {
- uni.showLoading({ title: '加载中...', mask: true });
- const res: any = await getNewProductApplyById(id);
- uni.hideLoading();
- if (res) {
- Object.assign(formData, {
- productName: res.productName || res.name || '',
- barcode: res.barcode || '',
- category: res.category || '',
- brand: res.brand || '',
- specification: res.specification || '',
- unit: res.unit || '',
- price: res.price || 0,
- costPrice: res.costPrice || res.cost || 0,
- images: res.images || '',
- description: res.description || '',
- productType: res.productType ?? 0,
- standard: res.standard ?? 1,
- stickerNum: res.stickerNum || '',
- length: res.length ?? undefined,
- width: res.width ?? undefined,
- height: res.height ?? undefined,
- exhibitHeight: res.exhibitHeight ?? undefined,
- columns: res.columns ?? undefined,
- numbers: res.numbers ?? undefined,
- reason: res.reason || ''
- });
- initPriceInputs();
- // 解析图片到分类slots:优先从独立字段,其次从逗号分隔字符串
- const allUrls: string[] = [];
- const directFields = [res.imageUrl, res.imageUrl2, res.imageUrl3, res.imageUrl4, res.imageUrl5,
- res.originalImageUrl1, res.originalImageUrl2, res.originalImageUrl3, res.originalImageUrl4];
- const hasDirect = directFields.some((f: string) => f);
- if (hasDirect) {
- for (const f of directFields) allUrls.push(f || '');
- } else if (res.images) {
- const parts = res.images.split(',');
- for (const p of parts) allUrls.push((p || '').trim());
- }
- for (let i = 0; i < 5 && i < allUrls.length; i++) {
- processedImageSlots.value[i].url = allUrls[i] || '';
- }
- for (let i = 0; i < 4 && i < allUrls.length - 5; i++) {
- originalImageSlots.value[i].url = allUrls[5 + i] || '';
- }
- }
- } catch (error) {
- uni.hideLoading();
- console.error('加载详情失败', error);
- }
- };
- onMounted(() => {
- const pages = getCurrentPages();
- const currentPage = pages[pages.length - 1] as any;
- const options = currentPage?.options || {};
- const id = options.id ? Number(options.id) : 0;
- const pageMode = options.mode || '';
- if (id) {
- editId.value = id;
- if (pageMode === 'view') {
- mode.value = 'view';
- } else {
- mode.value = 'edit';
- }
- loadDetail(id);
- }
- });
- </script>
- <style lang="scss" scoped>
- .page {
- min-height: 100vh;
- background: $bg-color-page;
- display: flex;
- flex-direction: column;
- }
- .form-scroll {
- flex: 1;
- padding: 24rpx;
- height: 0;
- }
- .form-section {
- background: $bg-color-card;
- border-radius: $radius-lg;
- padding: 0 24rpx;
- margin-bottom: 20rpx;
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
- }
- .section-title {
- padding: 28rpx 0 12rpx;
- }
- .section-title-text {
- font-size: $font-size-base;
- font-weight: 600;
- color: $text-color-primary;
- }
- .form-item {
- padding: 18rpx 0;
- &.required .form-label::before {
- content: '*';
- color: $error-color;
- margin-right: 6rpx;
- }
- &.textarea-item {
- padding-bottom: 20rpx;
- }
- }
- .form-label {
- font-size: $font-size-sm;
- color: $text-color-secondary;
- margin-bottom: 12rpx;
- display: block;
- }
- .form-input-wrap {
- display: flex;
- align-items: center;
- background: #FAFAFA;
- border-radius: $radius-base;
- padding: 0 20rpx;
- height: 80rpx;
- }
- .form-input {
- flex: 1;
- height: 80rpx;
- font-size: $font-size-base;
- color: $text-color-primary;
- }
- .scan-btn {
- width: 60rpx;
- height: 60rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-left: 12rpx;
- border-radius: $radius-base;
- background: $primary-color-bg;
- &:active { opacity: 0.7; }
- }
- .scan-icon {
- width: 36rpx;
- height: 30rpx;
- border: 3rpx solid $primary-color;
- border-radius: 4rpx;
- position: relative;
- &::after {
- content: '';
- position: absolute;
- top: -8rpx;
- right: -8rpx;
- width: 12rpx;
- height: 3rpx;
- background: $primary-color;
- border-radius: 2rpx;
- }
- }
- .form-warning {
- font-size: $font-size-xs;
- color: $warning-color;
- margin-top: 8rpx;
- display: block;
- }
- .form-textarea {
- width: 100%;
- background: #FAFAFA;
- border-radius: $radius-base;
- padding: 20rpx;
- font-size: $font-size-base;
- color: $text-color-primary;
- box-sizing: border-box;
- }
- .char-count {
- display: block;
- text-align: right;
- font-size: $font-size-xs;
- color: $text-color-muted;
- margin-top: 8rpx;
- }
- .image-upload-area {
- padding: 20rpx 0;
- }
- .labeled-image-list {
- display: flex;
- flex-wrap: wrap;
- gap: 16rpx;
- }
- .labeled-image-item {
- position: relative;
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 8rpx;
- }
- .labeled-image-title {
- font-size: 22rpx;
- color: $text-color-muted;
- }
- .label-image-wrap {
- width: 150rpx;
- height: 150rpx;
- border-radius: $radius-base;
- overflow: hidden;
- background: #FAFAFA;
- }
- .label-image-wrap .upload-image {
- width: 150rpx;
- height: 150rpx;
- border-radius: $radius-base;
- background: $bg-color-page;
- }
- .label-image-wrap .image-add {
- width: 150rpx;
- height: 150rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- background: #FAFAFA;
- &:active { opacity: 0.8; }
- }
- .label-image-delete {
- position: absolute;
- top: 18rpx;
- right: 2rpx;
- width: 36rpx;
- height: 36rpx;
- background: $error-color;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .image-list {
- display: flex;
- flex-wrap: wrap;
- gap: 16rpx;
- }
- .image-item {
- position: relative;
- width: 200rpx;
- height: 200rpx;
- }
- .upload-image {
- width: 200rpx;
- height: 200rpx;
- border-radius: $radius-base;
- background: $bg-color-page;
- }
- .image-delete {
- position: absolute;
- top: -12rpx;
- right: -12rpx;
- width: 40rpx;
- height: 40rpx;
- background: $error-color;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
- }
- .delete-icon {
- font-size: 28rpx;
- color: #fff;
- line-height: 1;
- }
- .image-add {
- width: 200rpx;
- height: 200rpx;
- border-radius: $radius-base;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- background: #FAFAFA;
- &:active {
- opacity: 0.8;
- }
- }
- .add-icon {
- font-size: 56rpx;
- color: $text-color-muted;
- line-height: 1;
- }
- .add-text {
- font-size: $font-size-xs;
- color: $text-color-muted;
- margin-top: 8rpx;
- }
- .image-tip {
- font-size: $font-size-xs;
- color: $text-color-placeholder;
- margin-top: 12rpx;
- display: block;
- }
- // 货道参数双列布局
- .form-row {
- display: flex;
- gap: 20rpx;
- }
- .form-item-half {
- flex: 1;
- min-width: 0;
- }
- // picker 文本样式
- .picker-value {
- font-size: $font-size-base;
- color: $text-color-primary;
- }
- .picker-placeholder {
- color: $text-color-placeholder;
- }
- .bottom-spacer {
- height: 140rpx;
- }
- .footer-bar {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- display: flex;
- gap: 20rpx;
- padding: 20rpx 24rpx;
- padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
- background: $bg-color-card;
- border-top: 1rpx solid $border-color;
- z-index: 100;
- }
- .btn-draft {
- flex: 1;
- height: 88rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: $radius-full;
- border: 2rpx solid $border-color;
- &:active { opacity: 0.7; }
- }
- .btn-draft-text {
- font-size: $font-size-lg;
- color: $text-color-secondary;
- font-weight: 500;
- }
- .btn-submit {
- flex: 2;
- height: 88rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- background: $primary-color;
- border-radius: $radius-full;
- &:active { opacity: 0.8; }
- }
- .btn-submit-text {
- font-size: $font-size-lg;
- color: $text-color-primary;
- font-weight: 600;
- }
- </style>
|