shish 8 месяцев назад
Родитель
Сommit
6e72980174

+ 1 - 1
ghsApp/src/admin/home/apply.vue

@@ -54,7 +54,7 @@ export default {
                         {name: "已下架",img: `${this.$constant.hostUrl}/image/ghs/home/hcgl.png`,url: "/admin/changePrice/outList"},
                         {name: "已删除",img: `${this.$constant.hostUrl}/image/ghs/home/hcgl.png`,url: "/admin/changePrice/stopList"},
                         {name: "采购人管理",img: `${this.$constant.hostUrl}/image/ghs/home/hcgl.png`,url: "/admin/changePrice/changeCgStaff"},
-                        {name: "购买须知",img: `${this.$constant.hostUrl}/image/ghs/home/hcgl.png`,url: "/admin/picText/purchaseGuide"},
+                        {name: "公告",img: `${this.$constant.hostUrl}/image/ghs/home/hcgl.png`,url: "/admin/picText/purchaseGuide"},
                         {name: "图文",img: `${this.$constant.hostUrl}/image/ghs/home/hcgl.png`,url: "/admin/picText/picTextList"},
                     ]
                 },

+ 59 - 35
ghsApp/src/admin/picText/purchaseGuide.vue

@@ -16,18 +16,32 @@
       </view>
     </view>
 
-    <!-- 选择 -->
+    <view class="form-section">
+      <view class="form-item textarea-item">
+        <text class="form-label">公告标题</text>
+      </view>
+      <view class="textarea-wrapper">
+        <textarea 
+          v-model="purchaseGuideText"
+          class="textarea-input"
+          placeholder="请输入标题"
+          :placeholder-style="{ color: '#999999' }"
+          :maxlength="500"
+        />
+        <view class="char-count">{{ purchaseGuideText.length }}/500</view>
+      </view>
+    </view>
+
     <view class="form-section">
       <view class="form-item" @click="showPicker">
-        <text class="form-label">购买须知</text>
+        <text class="form-label">公告详情</text>
         <view class="form-control">
-          <text class="select-text">{{ selectedValue || '请选择' }}</text>
+          <text class="select-text">{{ selectedValue || '请选图文' }}</text>
           <text class="arrow">></text>
         </view>
       </view>
     </view>
 
-    <!-- 按钮部分 -->
     <view class="button-section">
       <button class="btn btn-cancel" @click="onCancel">返回</button>
       <button class="btn btn-submit" @click="onSubmit">提交</button>
@@ -46,7 +60,8 @@ export default {
         selectedValue: '', // 选中的值
         saveSelectedValue: '', // 保存选中的值
         selectedId: 0, // 选中的id
-        formData: {}
+        formData: {},
+        purchaseGuideText: '' // 公告内容
     }
   },
   onShow() {
@@ -60,7 +75,7 @@ export default {
         getShopPurchaseGuide().then(res => {
             this.purchaseGuideData = res.data.shopExt;
             this.status = this.purchaseGuideData.purchaseGuide > 0 ? true : false;
-            
+            this.purchaseGuideText = res.data.shopExt && res.data.shopExt.purchaseGuideText ? res.data.shopExt.purchaseGuideText : ''
             // 根据 purchaseGuide 和 title 设置选中值
             if (this.purchaseGuideData.purchaseGuide !== "0" && this.purchaseGuideData.title) {
                 this.selectedValue = `${this.purchaseGuideData.title} (id: ${this.purchaseGuideData.purchaseGuide})`;
@@ -75,55 +90,35 @@ export default {
     // 状态开关变化
     onStatusChange(e) {
       this.status = e.detail.value
-      console.log('状态变化:', this.status ? '开启' : '关闭')
       if (this.status) {
         this.selectedValue = this.saveSelectedValue;
       } else {
         this.selectedValue = '...';
       }
     },
-
     // 显示选择器
     showPicker() {
-      if (this.status == false) {
-        this.$msg('状态开启后,才能选择购买须知')
-        return
-      }
-      uni.navigateTo({
-        url: `/admin/picText/picTextList?selectedId=${this.selectedId}`
-      });
+      uni.navigateTo({ url: `/admin/picText/picTextList?selectedId=${this.selectedId}` })
     },
-
     // 取消按钮
     onCancel() {
       uni.navigateBack();
     },
-
     // 提交按钮
     onSubmit() {
-      if (!this.selectedValue) {
-        this.$msg('请先选择选项')
-        return
-      }
-
       const formData = {
         picTextId: this.selectedId,
-        switch: this.status ? 1 : 0
+        switch: this.status ? 1 : 0,
+        purchaseGuideText:this.purchaseGuideText
       }
-      //console.log('提交表单数据:', formData)
-      
-      // 这里可以调用API提交数据
-      uni.showLoading({
-        title: '提交中...'
-      })
-
+      uni.showLoading()
       switchPurchaseGuide(formData).then(res => {
         uni.hideLoading();
         if(res.code == 1){
-          uni.showToast({
-            title: '提交成功',
-            icon: 'success'
-          })
+          uni.showToast({ title: '提交成功', icon: 'success' })
+          setTimeout(() => {
+            uni.navigateBack()
+          }, 1500);
         } else {
           this.$msg(res.msg)
         }
@@ -131,7 +126,6 @@ export default {
     },
 
     updateSelectedItem(data) {
-      console.log('更新选中项:', data)
       // 更新选中项显示
       if (data && data.picTextId && data.title) {
         this.selectedValue = `${data.title} (ID: ${data.picTextId})`;
@@ -211,6 +205,36 @@ export default {
   margin-left: 4rpx;
 }
 
+.textarea-item {
+  min-height: auto;
+  padding: 30rpx 0 20rpx 0;
+}
+
+.textarea-wrapper {
+  position: relative;
+  padding: 0 0 30rpx 0;
+}
+
+.textarea-input {
+  width: 100%;
+  height: 200rpx;
+  padding: 20rpx;
+  border: 1rpx solid #e0e0e0;
+  border-radius: 8rpx;
+  font-size: 28rpx;
+  color: #333333;
+  box-sizing: border-box;
+  line-height: 1.5;
+}
+
+.char-count {
+  position: absolute;
+  bottom: 40rpx;
+  right: 20rpx;
+  font-size: 24rpx;
+  color: #999999;
+}
+
 .button-section {
   display: flex;
   gap: 30rpx;

+ 30 - 2
hdApp/src/pagesPurchase/ghsProduct.vue

@@ -13,9 +13,12 @@
 					</view>
 				</view>
 			</view>
-			<view>
-			<image v-if="buyNotice == 1" :src="`${constant.hostUrl}/image/cg/buy_look2.png?v=1`" @click.stop="getReadMe(ghsInfo.shopId)" style="border-radius:10upx;margin-top:9upx;" mode="widthFix"></image>
+			
+			<image v-if="buyNotice == 1 && (ghsInfo.buyNoticeText == '' || ghsInfo.buyNoticeText == null)" :src="`${constant.hostUrl}/image/cg/buy_look2.png?v=1`" @click.stop="getReadMe(ghsInfo.shopId)" style="border-radius:10upx;margin-top:9upx;" mode="widthFix"></image>
+			<view class="notice-banner" @click.stop="getReadMe(ghsInfo.shopId)" v-if="ghsInfo.buyNoticeText != ''">
+				<text class="notice-text">{{ ghsInfo.buyNoticeText }}</text>
 			</view>
+
 		</view>
 
 		<view class="input-wrap" >
@@ -839,6 +842,31 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+.notice-banner {
+	margin-top: 9upx;
+	padding: 20upx 24upx;
+	background: linear-gradient(135deg, #3385FF 0%, #5BA3FF 100%);
+	border-radius: 10upx;
+	box-shadow: 0upx 4upx 12upx rgba(51, 133, 255, 0.2);
+	cursor: pointer;
+	transition: transform 0.2s ease, box-shadow 0.2s ease;
+
+	&:active {
+		transform: scale(0.98);
+		box-shadow: 0upx 2upx 8upx rgba(51, 133, 255, 0.15);
+	}
+
+	.notice-text {
+		display: block;
+		font-size: 28upx;
+		color: #ffffff;
+		line-height: 1.6;
+		word-wrap: break-word;
+		text-align: left;
+		font-weight: 500;
+	}
+}
+
 .class-popup-style{
 	z-index:999999;
 }