Преглед изворни кода

Merge branch 'zhongqi-intraCityExpress'

shish пре 11 месеци
родитељ
комит
46dc74b09a

+ 1 - 3
.cursor/rules/general-rules.mdc

@@ -16,7 +16,6 @@ alwaysApply: true
 9. **Vue 语法**: 本项目使用的是 Vue 2,请使用 Options API。
 
 ### 跨平台兼容性
-- **小程序限制**: 注意小程序的包大小限制(主包2M,总包20M),合理使用分包加载
 - **App 端**: 考虑 App 端的原生能力和性能特性
 - **H5 端**: 注意浏览器兼容性和 SEO 优化
 - **平台差异**: 使用条件编译处理平台特有功能,如支付、分享、定位等
@@ -40,7 +39,6 @@ alwaysApply: true
 - hd       -- 桌面电脑 web 端
 
 **其他项目**
-- jdApp, mallApp -- 其他业务线的移动端应用
-- jdadmin -- 基地管理后台
+- mallApp -- 其他业务线的移动端应用
 
 **重要说明**: 各个项目是相互独立的,修改代码时请确认在对应项目目录中操作,不跨项目目录。

+ 45 - 9
hdApp/src/admin/express/create.vue

@@ -19,7 +19,7 @@
         <view class="section-title">包裹信息</view>
         <view class="form-item">
           <text class="item-label">包裹数量</text>
-          <input class="item-input" type="number" v-model="expressForm.packageNum" placeholder="请输入包裹数量" />
+          <input class="item-input" type="number" v-model="expressForm.packageNum" placeholder="请输入包裹数量" disabled />
         </view>
         <view class="form-item required">
           <text class="item-label">重量(kg)</text>
@@ -29,18 +29,21 @@
 
       <!-- 收货信息 -->
       <view class="form-section">
-        <view class="section-title">收货信息</view>
+        <view class="section-header">
+          <view class="title">收货信息</view>
+          <button v-if="!expressForm.user_name || !expressForm.user_phone" class="admin-button-com mini-btn" @click="goToModifyPage">修改</button>
+        </view>
         <view class="form-item required">
           <text class="item-label">收货人</text>
-          <input class="item-input" v-model="expressForm.user_name" placeholder="请输入收货人姓名" />
+          <input class="item-input" v-model="expressForm.user_name" disabled />
         </view>
         <view class="form-item required">
           <text class="item-label">手机号</text>
-          <input class="item-input" v-model="expressForm.user_phone" placeholder="请输入收货人手机号" />
+          <input class="item-input" v-model="expressForm.user_phone" disabled />
         </view>
         <view class="form-item required">
           <text class="item-label">详细地址</text>
-          <textarea class="item-textarea" v-model="expressForm.user_address" placeholder="请输入详细地址" />
+          <textarea class="item-textarea" v-model="expressForm.user_address" disabled />
         </view>
       </view>
 
@@ -53,12 +56,12 @@
       </view>
 
       <!-- 配送备注 -->
-      <view class="form-section">
+      <!-- <view class="form-section">
         <view class="section-title">配送备注</view>
         <view class="form-item">
           <textarea class="item-textarea large" v-model="expressForm.note" placeholder="请输入配送备注(选填)" maxlength="200"></textarea>
         </view>
-      </view>
+      </view> -->
 
       <!-- 操作按钮 -->
       <view class="button-section">
@@ -113,11 +116,29 @@ export default {
     if (options.orderId) {
       this.orderId = options.orderId
       this.isNew = options.isNew
+      //this.getOrderDetail()
+    }
+  },
+  onShow() {
+    if(this.orderId){
       this.getOrderDetail()
+    } else {
+      setTimeout(() => {
+        this.getOrderDetail()
+      }, 100)
     }
   },
   methods: {
     init(){},
+    /**
+     * 跳转到修改订单页面
+     */
+    goToModifyPage() {
+      uni.navigateTo({
+        url: `/admin/order/modify?id=${this.orderId}`
+      })
+    },
+
     /**
      * 获取订单详情
      */
@@ -324,6 +345,21 @@ export default {
   border-bottom: 2upx solid #eee;
 }
 
+.section-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 30upx;
+  padding-bottom: 20upx;
+  border-bottom: 2upx solid #eee;
+
+  .title {
+    font-size: 32upx;
+    font-weight: bold;
+    color: #333;
+  }
+}
+
 .form-item {
   display: flex;
   align-items: flex-start;
@@ -364,8 +400,8 @@ export default {
 
   .item-textarea {
     flex: 1;
-    max-height: 160upx;
-    min-height: 90upx;
+    max-height: 150upx;
+    min-height: 80upx;
     border: 2upx solid #eee;
     border-radius: 8upx;
     padding: 20upx;

+ 23 - 0
hdApp/src/admin/goods/add.vue

@@ -92,6 +92,11 @@
           <input v-model="form.flowerNum" placeholder-class="phcolor" @focus="onFlowerNumFocus" @blur="onFlowerNumBlur" class="tui-input" name="flowerNum" placeholder="用于判断花束大小" maxlength="5" type="number" />
         </tui-list-cell>
 
+        <tui-list-cell class="line-cell" :hover="false">
+          <view class="tui-title">重量(千克)</view>
+          <input v-model="form.weight" placeholder-class="phcolor" @focus="onWeightFocus" @blur="onWeightBlur" class="tui-input" name="weight" placeholder="单位:千克,可输入小数" maxlength="10" type="digit" />
+        </tui-list-cell>
+
         <tui-list-cell class="line-cell" :hover="false">
           <view class="tui-title">节日涨价</view>
           <view class="btn-group">
@@ -167,6 +172,7 @@ export default {
         stockSet: '0', // 默认库存充足
         priceType: '0', // 默认无价格
         flowerNum: "",
+        weight: "",
         catIds: [],
         autoRise: "1",
         needSend: "0",
@@ -450,6 +456,15 @@ export default {
           return false;
         }
       }
+
+      // 验证重量(千克)
+      if (this.form.weight !== "") {
+        const weightNum = parseFloat(this.form.weight);
+        if (isNaN(weightNum) || weightNum < 0) {
+          this.$msg('重量必须是大于等于0的数字!');
+          return false;
+        }
+      }
       
       let formData = e.detail.value;
       let checkRes = form.validation(formData, rules);
@@ -476,6 +491,14 @@ export default {
     // 花支数输入框失焦
     onFlowerNumBlur() {
       this.onInputBlur('flowerNum');
+    },
+    // 重量输入框聚焦
+    onWeightFocus() {
+      this.onInputFocus('weight');
+    },
+    // 重量输入框失焦
+    onWeightBlur() {
+      this.onInputBlur('weight');
     }
   }
 };

+ 25 - 46
hdApp/src/admin/goods/detail.vue

@@ -97,6 +97,11 @@
           <input v-model="form.flowerNum" @focus="onFlowerNumFocus" @blur="onFlowerNumBlur" placeholder-class="phcolor" class="tui-input" name="flowerNum" placeholder="用于判断花束大小" maxlength="5" type="number" />
         </tui-list-cell>
 
+        <tui-list-cell class="line-cell" :hover="false">
+          <view class="tui-title">重量(千克)</view>
+          <input v-model="form.weight" @focus="onWeightFocus" @blur="onWeightBlur" placeholder-class="phcolor" class="tui-input" name="weight" placeholder="单位:千克,可输入小数" maxlength="10" type="digit" />
+        </tui-list-cell>
+
         <tui-list-cell class="line-cell" :hover="false">
           <view class="tui-title">节日涨价</view>
           <view class="btn-group">
@@ -140,12 +145,10 @@
   </view>
 </template>
 <script>
-import { mapGetters } from "vuex";
 import TuiListCell from "@/components/plugin/list-cell";
-import AppUploader from "@/components/app-uploader";
 const form = require("@/utils/formValidation.js");
 import { getClass } from "@/api/category";
-import { getGoodsDetail, addGoodsData, updateGoodsData } from "@/api/goods";
+import { getGoodsDetail, updateGoodsData } from "@/api/goods";
 //图片上传插件来源:https://ext.dcloud.net.cn/plugin?id=2922 已改造,不能再升级 shish 20211228
 import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
 //import productMins from "@/mixins/product"; //复制页面代码时,没去掉,引入的话会导致页面崩溃
@@ -154,17 +157,13 @@ export default {
   name: "add",
   components: {
     TuiListCell,
-    AppUploader,
     htzImageUpload
   },
 	mixins: [inputRestore],//productMins, 
   data() {
     return {
-			selectJobType: "addGoodsSelectItem",
       headers:{token:''},
       currentImgData: [],
-      status: 1,
-      goodsInfo:[],
       loading: false, // 添加加载状态
 
       form: {
@@ -182,7 +181,7 @@ export default {
         status: "1",
         flower:1,
         flowerNum:0,
-        setItemNum:0,
+        weight: "",
         stock:0,
         cover: "",
         shortCover: ""
@@ -192,9 +191,6 @@ export default {
     };
   },
   onLoad() {
-		if(this.option.id){
-			this.selectJobId = this.option.id
-		}
     const token = uni.getStorageSync('token')
     this.headers.token = token
     this.getDetail()
@@ -218,15 +214,6 @@ export default {
   },
   methods: {
     init(){},
-    changeKind(){
-      this.pageTo({url:'/admin/goods/selectKind?style=2&flower='+this.form.flower})
-    },
-    setItemNumChange(e){
-      this.form.setItemNum = e.detail.value;
-    },
-    selectItem(goods){
-      this.pageTo({url:'/admin/goods/selectItem?id='+goods.id})
-    },
     imgDeleteFn(res){
       const index = res.index
       this.form.shopImg.splice(index,1)
@@ -299,25 +286,6 @@ export default {
           return;
         }
 
-        this.goodsInfo = res.data
-
-        if(this.goodsInfo.goodsItem && !this.$util.isEmpty(this.goodsInfo.goodsItem)){
-          const newItem = this.goodsInfo.goodsItem.map(ele=>{
-            let unitType = ele.unitType
-            let bigCount = 0
-            let smallCount = 0
-            let num = ele.num
-            if(unitType == 0){
-              bigCount = num
-            }else{
-              smallCount = num
-            }
-            return {name:ele.name,cover:ele.smallCover,itemId:ele.ptItemId,id:ele.itemId,ratio:ele.ratio,
-            bigCount:bigCount,smallCount:smallCount,bigUnit:ele.bigName,smallUnit:ele.smallName,shortCover:ele.shortCover}
-          })
-          //this.pushToSave(newItem)
-        }
-
         Object.keys(this.form).forEach((i) => {
           this.form[i] = res.data[i];
         });
@@ -342,7 +310,6 @@ export default {
         this.form.sold = res.data.sold || "";
         // 添加仅支持自取字段
         this.form.needSend = res.data.needSend || "0";
-        
         // 设置状态
         this.form.status = res.data.status || "1";
         
@@ -435,6 +402,15 @@ export default {
           return false;
         }
       }
+
+      // 验证重量(千克)
+      if (this.form.weight !== "") {
+        const weightNum = parseFloat(this.form.weight);
+        if (isNaN(weightNum) || weightNum < 0) {
+          this.$msg('重量必须是大于等于0的数字!');
+          return false;
+        }
+      }
       
       let formData = e.detail.value;
       let checkRes = form.validation(formData, rules);
@@ -520,6 +496,7 @@ export default {
                   stock: this.form.stockSet === '1' ? parseInt(this.form.stock || 0) : 9999,
                   sold: parseInt(this.form.sold || 0),
                   flowerNum: parseInt(this.form.flowerNum || 0),
+                  weight: parseFloat(this.form.weight || 0),
                   autoRise: this.form.autoRise,
                   needSend: this.form.needSend,
                   freightType: this.form.freightType,
@@ -563,12 +540,6 @@ export default {
     freightChange(e) {
       this.form.freightType = e.detail.value;
     },
-    flowerChange(e){
-      if(this.option.id && Number(this.option.id)>0){
-        this.$msg('不可修改')
-        return false
-      }
-    },
     statusChange(e){
       this.form.status = e.detail.value;
     },
@@ -596,6 +567,14 @@ export default {
     // 花支数输入框失焦
     onFlowerNumBlur() {
       this.onInputBlur('flowerNum');
+    },
+    // 重量输入框聚焦
+    onWeightFocus() {
+      this.onInputFocus('weight');
+    },
+    // 重量输入框失焦
+    onWeightBlur() {
+      this.onInputBlur('weight');
     }
   }
 };

+ 1 - 1
mallApp/src/pages/order/buy.vue

@@ -89,7 +89,6 @@ export default {
     this.option = option || {};
     this.init();
   },
-  mounted() {},
   computed: {
     mayPayAmount(){
       let price = (this.goodsInfo.price || 0) * (this.goodsInfo.buyNum || 0)
@@ -144,6 +143,7 @@ export default {
       try {
         const deliveryForm = (ref && ref.form) ? ref.form : {};
         const goodsInfo = this.goodsInfo || {};
+        
         const cargoName = goodsInfo.goodsName || goodsInfo.name || '商品';
         const packageNum = Number(goodsInfo.buyNum || this.form.goodsNum || 0);
         // 商品总重量 = 单件重量(kg,缺省视为 1) * 数量