Browse Source

Update goods-update and server-mysql files

pull/19/head
徐飞洋 1 month ago
parent
commit
ecd66120c6
  1. 6
      pages/goods-update/goods-update.js
  2. 5
      pages/goods-update/goods-update.wxml
  3. 23
      pages/goods-update/goods-update.wxss
  4. 7
      server-example/server-mysql.js

6
pages/goods-update/goods-update.js

@ -1104,7 +1104,8 @@ Page({
region: goodsDetail.region || '', region: goodsDetail.region || '',
grossWeight: goodsDetail.grossWeight || '', grossWeight: goodsDetail.grossWeight || '',
product_contact: goodsDetail.product_contact || '', product_contact: goodsDetail.product_contact || '',
contact_phone: goodsDetail.contact_phone || '' contact_phone: goodsDetail.contact_phone || '',
description: goodsDetail.description || goodsDetail.remark || ''
}; };
// 保存原始规格和价格信息,用于比较差异 // 保存原始规格和价格信息,用于比较差异
@ -1219,12 +1220,13 @@ Page({
console.log('【saveEdit】editSupply.id:', editSupply.id); console.log('【saveEdit】editSupply.id:', editSupply.id);
console.log('【saveEdit】最终使用的productId:', productId); console.log('【saveEdit】最终使用的productId:', productId);
// 使用新的快速更新接口,更新价格、联系人和电话 // 使用新的快速更新接口,更新价格、联系人和电话以及货源描述
const updateData = { const updateData = {
productId: productId, productId: productId,
price: priceStr, price: priceStr,
product_contact: editSupply.product_contact || '', product_contact: editSupply.product_contact || '',
contact_phone: editSupply.contact_phone || '', contact_phone: editSupply.contact_phone || '',
description: editSupply.description || ''
}; };
console.log('【saveEdit】快速更新数据:', updateData); console.log('【saveEdit】快速更新数据:', updateData);

5
pages/goods-update/goods-update.wxml

@ -304,8 +304,11 @@
<view class="edit-form-label">联系电话</view> <view class="edit-form-label">联系电话</view>
<input class="edit-form-input" type="number" placeholder="请输入联系电话" bindinput="onEditInput" data-field="contact_phone" value="{{editSupply.contact_phone}}"></input> <input class="edit-form-input" type="number" placeholder="请输入联系电话" bindinput="onEditInput" data-field="contact_phone" value="{{editSupply.contact_phone}}"></input>
<view class="edit-form-label">货源描述</view>
<textarea class="edit-form-textarea" placeholder="请输入货源描述" bindinput="onEditInput" data-field="description" value="{{editSupply.description}}" auto-height="true" maxlength="500"></textarea>
<!-- 添加底部空白区域 --> <!-- 添加底部空白区域 -->
<view style="height: 20vh; background: transparent;"></view> <view style="height: 10vh; background: transparent;"></view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>

23
pages/goods-update/goods-update.wxss

@ -1032,6 +1032,29 @@ video.slider-media .wx-video-volume-icon {
font-family: inherit; font-family: inherit;
} }
.edit-form-textarea {
width: 100%;
min-height: 150rpx;
padding: 24rpx;
font-size: 30rpx;
border: 2rpx solid #eee;
border-radius: 12rpx;
box-sizing: border-box;
margin: 0 auto 30rpx;
display: block;
font-family: inherit;
color: #333;
resize: none;
line-height: 1.5;
}
.edit-form-textarea::placeholder {
font-size: 24rpx;
color: #999;
text-align: left;
font-family: inherit;
}
.edit-form-select { .edit-form-select {
width: 100%; width: 100%;
height: 90rpx; height: 90rpx;

7
server-example/server-mysql.js

@ -7375,7 +7375,7 @@ app.post('/api/products/update-contacts', async (req, res) => {
app.post('/api/products/quick-update', async (req, res) => { app.post('/api/products/quick-update', async (req, res) => {
console.log('【快速更新】收到请求:', req.body); console.log('【快速更新】收到请求:', req.body);
try { try {
const { productId, price, product_contact, contact_phone } = req.body; const { productId, price, product_contact, contact_phone, description } = req.body;
if (!productId) { if (!productId) {
return res.status(400).json({ return res.status(400).json({
@ -7421,6 +7421,11 @@ app.post('/api/products/quick-update', async (req, res) => {
console.log('【快速更新】更新联系电话:', contact_phone); console.log('【快速更新】更新联系电话:', contact_phone);
} }
if (description !== undefined) {
updateFields.description = description;
console.log('【快速更新】更新货源描述:', description);
}
// 执行更新 // 执行更新
await Product.update(updateFields, { await Product.update(updateFields, {
where: { productId } where: { productId }

Loading…
Cancel
Save