Sfoglia il codice sorgente

feat:新增产品列表操作、评论

storeBelieveInLight 1 anno fa
parent
commit
cb47b283cb

+ 60 - 0
commit/product.js

@@ -164,4 +164,64 @@ export function reviewGoodsReplyApi(id,data) {
164 164
         data,
165 165
         apiType
166 166
     })
167
+}
168
+
169
+
170
+/**
171
+ * @description 商品列表 -- 上下架
172
+ */
173
+
174
+export function changeshowApi(id, data) {
175
+     return myRequestPhp({
176
+         url: `${pre}mer/store/product/status/${id}`,
177
+         method: 'POST',
178
+         data,
179
+         apiType
180
+     })
181
+}
182
+/**
183
+ * @description 商品列表--删除
184
+ */
185
+export function destoryApi(id,data) {
186
+     return myRequestPhp({
187
+         url: `${pre}mer/store/product/destory/${id}`,
188
+         method: 'DELETE',
189
+         data,
190
+         apiType
191
+     })
192
+}
193
+
194
+/**
195
+ * @description 商品列表 -- 删除
196
+ */
197
+export function productDeleteApi(id,data) {
198
+     return myRequestPhp({
199
+         url: `${pre}mer/store/product/delete/${id}`,
200
+         method: 'DELETE',
201
+         data,
202
+         apiType
203
+     })
204
+}
205
+
206
+/***
207
+ * @description 商品列表 -- 恢复商品
208
+ */
209
+export function productRestoreApi(id,data) {
210
+      return myRequestPhp({
211
+          url: `${pre}mer/store/product/restore/${id}`,
212
+          method: 'POST',
213
+          data,
214
+          apiType
215
+      })
216
+}
217
+
218
+
219
+
220
+export function Addseckill(data) {
221
+     return myRequestPhp({
222
+         url: `${pre}mer/store/product/seckill`,
223
+         method: 'POST',
224
+         data,
225
+         apiType
226
+     })
167 227
 }

+ 5 - 4
commit/requestPhp.js

@@ -13,7 +13,8 @@ export function myRequestPhp(options) {
13 13
 	let header = {
14 14
 		'Content-Type': 'application/json;charset=UTF-8',
15 15
 		// 'X-Token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuaHh4ZmIuY29tIiwiYXVkIjoiYXBpLmh4eGZiLmNvbSIsImlhdCI6MTc0MDM3MTM1NSwibmJmIjoxNzQwMzcxMzU1LCJleHAiOjE3NTExNzEzNTUsImp0aSI6WzI5OCwibWVyIl19.j2f8VwdwWY4zBpcijHntzUZ9YUms2SxChaVsYf7KnPs',
16
-		"x-Token": uni.getStorageSync('phpToken'), //token
16
+		// "x-Token": uni.getStorageSync('phpToken'), //token
17
+		// "X-Token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuaHh4ZmIuY29tIiwiYXVkIjoiYXBpLmh4eGZiLmNvbSIsImlhdCI6MTc0MDU3MTQ0OCwibmJmIjoxNzQwNTcxNDQ4LCJleHAiOjE3NTEzNzE0NDgsImp0aSI6WzM1NCwibWVyIl19.PVwYv71Gq9RxTxQclUoFMgc8cZt0ju3zQkxk6SGCQJw",
17 18
 		...options.header
18 19
 	}
19 20
 	return new Promise((resolve, reject) => {
@@ -39,14 +40,14 @@ export function myRequestPhp(options) {
39 40
 					await  getPhpToken()
40 41
 					 resolve(res)
41 42
 				} else { //除了500都会走以下操作
43
+					// console.log(message, "messag9999e")
42 44
 					 uni.showToast({
43 45
 						title: message,
44 46
 						icon: 'none',
45 47
 						duration: 6000
46 48
 					})
47
-					return
49
+					// reject(res)
48 50
 				}
49
-				uni.hideToast();
50 51
 			},
51 52
 			fail(err) {
52 53
 				console.log(err,"接口")
@@ -67,7 +68,7 @@ export function myRequestPhp(options) {
67 68
 
68 69
 			},
69 70
 			complete() {
70
-				uni.hideToast();
71
+				// uni.hideToast();
71 72
 			}
72 73
 		});
73 74
 	}).catch(() => {

+ 1 - 0
pages/supplychainon/supplychainon.vue

@@ -106,6 +106,7 @@ export default {
106 106
       this.type = item.type || 1;
107 107
       this.page = 1;
108 108
       this.is_panudn = true;
109
+       uni.pageScrollTo({ scrollTop: 0, duration: 0 });
109 110
       await this.getSupplyChainListData();
110 111
     },
111 112
     async getSupplyChainTabData() {

+ 66 - 36
shop/afterSalesManagement/afterCardListInfo.vue

@@ -1,8 +1,15 @@
1 1
 <template>
2 2
   <view class="details-xiangqing">
3 3
     <view class="details-xiangqing-top">
4
-      <view class="details-xiangqing-top-let" v-if="detailItem.order&&detailItem.order.mer_avatar">
5
-        <image :src="detailItem.order.mer_avatar" mode="widthFix" v-if="detailItem.order.mer_avatar"></image>
4
+      <view
5
+        class="details-xiangqing-top-let"
6
+        v-if="detailItem.order && detailItem.order.mer_avatar"
7
+      >
8
+        <image
9
+          :src="detailItem.order.mer_avatar"
10
+          mode="widthFix"
11
+          v-if="detailItem.order.mer_avatar"
12
+        ></image>
6 13
       </view>
7 14
       <view class="details-xiangqing-top-in" v-if="detailItem.order">
8 15
         {{ detailItem.refund_order_sn }}
@@ -15,29 +22,49 @@
15 22
           class="arrow_right_log"
16 23
         ></uni-icons>
17 24
       </view>
18
-      <view class="details-xiangqingt-yi-top-right"> {{formatDataValue(detailItem,'status')}} </view>
25
+      <view class="details-xiangqingt-yi-top-right">
26
+        {{ formatDataValue(detailItem, "status") }}
27
+      </view>
19 28
     </view>
20 29
     <view class="details-xiangqing-niri">
21 30
       <view
22 31
         class="order-list-yi-in-neibu"
23 32
         v-for="(item, index) in detailItem.refundProduct"
24
-        :key="index+'_index'+item.order_product_id"
33
+        :key="index + '_index' + item.order_product_id"
25 34
       >
26
-      <!-- item.product.cart_info.product -->
35
+        <!-- item.product.cart_info.product -->
27 36
         <view class="order-list-yi-in-neibu-left">
28 37
           <view class="order-list-yi-in-neibu-left-img" v-if="item.product">
29
-            <image :src="item.product.cart_info.product.image" @error="handleError"  mode="widthFix" v-if="item.product.cart_info && !isError"></image>
30
-            <image
31
-            v-else
32
-              src="/static/images/new_ui/wutu.png"
33
-             mode="widthFix"
34
-            />
38
+            <template
39
+              v-if="
40
+                item.product.cart_info &&
41
+                item.product.cart_info.product &&
42
+                item.product.cart_info.product.image &&
43
+                !isError
44
+              "
45
+            >
46
+              <image
47
+              class="cusotm"
48
+                :src="item.product.cart_info.product.image"
49
+                @error="handleError"
50
+                mode="aspectFit"
51
+              ></image>
52
+            </template>
53
+            <template v-else>
54
+              <image src="/static/images/new_ui/wutu.png" mode="aspectFit" />
55
+            </template>
35 56
           </view>
36 57
           <view class="order-list-yi-in-neibu-left-url">
37
-            <view class="order-list-yi-in-neibu-left-url-top" v-if="item.product">
38
-              {{ item.product.cart_info.product.store_name || '' }}
58
+            <view
59
+              class="order-list-yi-in-neibu-left-url-top"
60
+              v-if="item.product"
61
+            >
62
+              {{ item.product.cart_info.product.store_name || "" }}
39 63
             </view>
40
-            <view class="order-list-yi-in-neibu-left-url-top" v-if="item.product">
64
+            <view
65
+              class="order-list-yi-in-neibu-left-url-top"
66
+              v-if="item.product"
67
+            >
41 68
               {{ item.product.cart_info.productAttr.sku }}
42 69
             </view>
43 70
           </view>
@@ -53,10 +80,15 @@
53 80
       </view>
54 81
 
55 82
       <view class="brn-ligd">
56
-        <view class="btn-cls" @click="viewWuLiu(detailItem)" v-if="detailItem&&detailItem.delivery_id"> 查看物流 </view>
83
+        <view
84
+          class="btn-cls"
85
+          @click="viewWuLiu(detailItem)"
86
+          v-if="detailItem && detailItem.delivery_id"
87
+        >
88
+          查看物流
89
+        </view>
57 90
         <view class="btn-cls" @click="viewDetail(detailItem)"> 查看详情 </view>
58 91
       </view>
59
-
60 92
     </view>
61 93
   </view>
62 94
 </template>
@@ -64,33 +96,32 @@
64 96
 <script>
65 97
 //订单详情 卡片详细信息
66 98
 import { copy } from "@/utils/index.js";
67
-import {orderRefundFilter} from "../commodity/orderUtil.js"
99
+import { orderRefundFilter } from "../commodity/orderUtil.js";
68 100
 export default {
69
-  props:{
70
-    detailItem:{
71
-      type:Object,
72
-      default:()=>{}
73
-
101
+  props: {
102
+    detailItem: {
103
+      type: Object,
104
+      default: () => {},
105
+    },
106
+    index: {
107
+      type: Number,
108
+      default: 0,
74 109
     },
75
-    index:{
76
-      type:Number,
77
-      default:0
78
-    }
79 110
   },
80 111
   data() {
81 112
     return {
82
-      isError:false
113
+      isError: false,
83 114
     };
84 115
   },
85 116
 
86 117
   methods: {
87
-        handleError(e){
88
-      this.isError = e.type=="error"?true:false
89
-      console.log(e,"e",this.isError)
118
+    handleError(e) {
119
+      this.isError = true;
120
+      // console.log(e,"e",this.isError)
90 121
     },
91
-    formatDataValue(data,type){
92
-      if(type === 'status'){
93
-        return orderRefundFilter(data[type]) || ''
122
+    formatDataValue(data, type) {
123
+      if (type === "status") {
124
+        return orderRefundFilter(data[type]) || "";
94 125
       }
95 126
     },
96 127
     handleCopy(val) {
@@ -99,12 +130,11 @@ export default {
99 130
     sendGoods() {},
100 131
     //查看物流
101 132
     viewWuLiu(val) {
102
-     this.$emit("viewWuLiu", val);
133
+      this.$emit("viewWuLiu", val);
103 134
     },
104 135
     viewDetail(val) {
105 136
       this.$emit("viewDetail", val);
106
-    }
107
-  
137
+    },
108 138
   },
109 139
 };
110 140
 </script>

+ 2 - 1
shop/afterSalesManagement/components/tablist.vue

@@ -1,5 +1,5 @@
1 1
 <template>
2
-  <view class="content">
2
+  <view class="content"  @touchmove.prevent>
3 3
     <view class="nav">
4 4
       <!-- 选项卡水平方向滑动,scroll-with-animation是滑动到下一个选项时,有一个延时效果 -->
5 5
       <scroll-view
@@ -7,6 +7,7 @@
7 7
         scroll-x="true"
8 8
         scroll-with-animation
9 9
         :scroll-left="scrollLeft"
10
+        @touchmove.stop
10 11
       >
11 12
         <view class="tab-scroll_box">
12 13
           <!-- 选项卡类别列表 -->

+ 5 - 0
shop/afterSalesManagement/index.vue

@@ -103,6 +103,7 @@ export default {
103 103
     this.is_panudn = true;
104 104
     this.list = [];
105 105
     this.getAfterSaleListData();
106
+    
106 107
   },
107 108
   onReachBottom() {
108 109
     if (this.is_panudn == true) {
@@ -237,6 +238,10 @@ export default {
237 238
       } else {
238 239
         this.status = "";
239 240
       }
241
+       this.page = 1;
242
+       this.list = [];
243
+      this.is_panudn = true;
244
+       uni.pageScrollTo({ scrollTop: 0, duration: 0 });
240 245
       await this.getAfterSaleListData();
241 246
     },
242 247
   },

+ 1 - 0
shop/commodity/order.vue

@@ -320,6 +320,7 @@ export default {
320 320
       this.page = 1;
321 321
        this.list = [];
322 322
       this.is_panudn = true;
323
+       uni.pageScrollTo({ scrollTop: 0, duration: 0 });
323 324
       this.orderList();
324 325
     },
325 326
     topgi() {

+ 6 - 1
shop/productManagementModule/components/productEvaluation/ProductEvaluationItem.vue

@@ -28,12 +28,13 @@
28 28
           :src="item.image"
29 29
           mode="aspectFill"
30 30
           @error="handleError"
31
+          @load="handleLoad"
31 32
           v-if="item.image && !isError"
32 33
         ></image>
33 34
         <image
34 35
           class="product-img"
35 36
           v-else
36
-          src="/static/images/new_ui/kongtu.png"
37
+          src="/static/images/new_ui/wutu.png"
37 38
           mode="scaleToFill"
38 39
         />
39 40
         <view class="product-detail">
@@ -75,8 +76,12 @@ export default {
75 76
   },
76 77
   methods: {
77 78
     handleError(e) {
79
+      console.log(e);
78 80
       this.isError = true;
79 81
     },
82
+    handleLoad(e){
83
+      // console.log(e,"LOAD");
84
+    },
80 85
     close() {
81 86
       this.$refs.ReplyRefs.close();
82 87
       this.$emit("handleReply", {

+ 2 - 1
shop/productManagementModule/components/tablist.vue

@@ -1,5 +1,5 @@
1 1
 <template>
2
-  <view class="content">
2
+  <view class="content" @touchmove.prevent>
3 3
     <view class="nav">
4 4
       <!-- 选项卡水平方向滑动,scroll-with-animation是滑动到下一个选项时,有一个延时效果 -->
5 5
       <scroll-view
@@ -7,6 +7,7 @@
7 7
         scroll-x="true"
8 8
         scroll-with-animation
9 9
         :scroll-left="scrollLeft"
10
+        @touchmove.stop
10 11
       >
11 12
         <view class="tab-scroll_box">
12 13
           <!-- 选项卡类别列表 -->

+ 502 - 48
shop/productManagementModule/productManagement.vue

@@ -13,55 +13,107 @@
13 13
         </view>
14 14
       </view>
15 15
       <view class="product-manger-content--tab">
16
-        <tabsVue :category="dataList" :currentActive="currentActive" @tabs="tabsHandleClick"/>
16
+        <tabsVue
17
+          :category="dataList"
18
+          :currentActive="currentActive"
19
+          @tabs="tabsHandleClick"
20
+        />
17 21
       </view>
18 22
     </view>
19 23
     <view class="product-manger-content--list">
20
-       <template v-if="list.length > 0">
21
-      <view class="list-card" v-for="(item, index) in list" :key="index">
22
-        <view class="list-card-top">
23
-          <view class="list-card-top--left">
24
-            <image
25
-              src="/static/images/new_ui/tianjiachanpin.png"
26
-              mode="scaleToFill"
27
-              @error="imgError"
28
-            />
29
-          </view>
30
-          <view class="list-card-top--right">
31
-            <view class="list-card-top--right-title"
32
-              >此处显示商品名称最多一行,显示不下此处显示商品名称最多一行,显示不下</view
33
-            >
34
-            <view class="list-card-top--right-description">
35
-              <view class="list-card-top--right-description--left">
36
-                <text class="title">销量</text>
37
-                <text>5000</text>
24
+      <template v-if="list.length > 0">
25
+        <view class="list-card" v-for="(item, index) in list" :key="index">
26
+          <view class="list-card-top">
27
+            <view class="list-card-top--left">
28
+              <image
29
+                v-if="item.image && !isError"
30
+                :src="item.image"
31
+                mode="scaleToFill"
32
+                @error="imgError"
33
+                @load="loadImage"
34
+              />
35
+              <image
36
+                v-else
37
+                src="/static/images/new_ui/wutu.png"
38
+                mode="scaleToFill"
39
+                @error="imgError"
40
+              />
41
+            </view>
42
+            <view class="list-card-top--right">
43
+              <view class="list-card-top--right-title">{{
44
+                item.store_name
45
+              }}</view>
46
+              <view class="list-card-top--right-description">
47
+                <view class="list-card-top--right-description--left">
48
+                  <text class="title">销量</text>
49
+                  <text class="mdikd">{{ item.sales || 0 }}</text>
50
+                </view>
51
+                <view class="list-card-top--right-description--right">
52
+                  <text class="title">库存</text>
53
+                  <text class="mdikd">{{ item.stock || 0 }}</text>
54
+                </view>
38 55
               </view>
39
-              <view class="list-card-top--right-description--right">
40
-                <text class="title">库存</text>
41
-                <text>5000</text>
56
+              <view class="list-card-top--right-description">
57
+                <view class="list-card-top--right-description--left">
58
+                  <text class="title">活动:</text>
59
+                  <text class="mdikd" style="color: red">{{
60
+                    item.seckill == 1 ? "秒杀" : "无"
61
+                  }}</text>
62
+                </view>
42 63
               </view>
43
-            </view>
44
-            <view class="list-card-top--right-price">
45
-              <view class="list-card-top--right-price--left">
46
-                <text>¥</text>
47
-                <text class="price">5000</text>
64
+              <view class="list-card-top--right-price">
65
+                <view class="list-card-top--right-price--left">
66
+                  <text>¥</text>
67
+                  <text class="price">{{ item.price || "0.00" }}</text>
68
+                </view>
48 69
               </view>
49 70
             </view>
50 71
           </view>
51
-        </view>
52
-        <view class="list-card-bottom-btn">
53
-          <view class="list-card-bottom-btn-list">
54
-            <view class="list-card-bottom-btn-list--item">推荐</view>
55
-            <view class="list-card-bottom-btn-list--item">驳回原因</view>
56
-            <view class="list-card-bottom-btn-list--item">上架</view>
57
-            <view class="list-card-bottom-btn-list--item">下架</view>
58
-            <view class="list-card-bottom-btn-list--item">删除草稿</view>
72
+          <view class="list-card-bottom-btn">
73
+            <view class="list-card-bottom-btn-list">
74
+              <button
75
+                class="list-card-bottom-btn-list--item set-activity active"
76
+                @click="huodong(item, index)"
77
+              >
78
+                活动
79
+              </button>
80
+              <!-- v-if="tableFrom.type === '5'" -->
81
+              <button
82
+                v-if="type == 5"
83
+                class="list-card-bottom-btn-list--item bohui-activity active"
84
+                @click="handleRestore(item.product_id)"
85
+              >
86
+                恢复商品
87
+              </button>
88
+              <template v-if="type == 1 || type == 2">
89
+                <button
90
+                  class="list-card-bottom-btn-list--item set-activity active"
91
+                  v-if="item.is_show == 0"
92
+                  @click="onHandleShow(item, 'shangjia')"
93
+                >
94
+                  上架
95
+                </button>
96
+                <button
97
+                  v-if="item.is_show == 1"
98
+                  class="list-card-bottom-btn-list--item set-activity active"
99
+                  @click="onHandleShow(item, 'xiajia')"
100
+                >
101
+                  下架
102
+                </button>
103
+              </template>
104
+              <button
105
+                v-if="type != 1 && type != 3 && type != 4"
106
+                class="list-card-bottom-btn-list--item delete-activity active"
107
+                @click="handleDelete(item, index)"
108
+              >
109
+                {{ type == "5" ? "删除" : "加入回收站" }}
110
+              </button>
111
+            </view>
59 112
           </view>
60 113
         </view>
61
-      </view>
62
-       </template>
63
-       <template v-else>
64
-        <emptyDataVue style="top:0"/>
114
+      </template>
115
+      <template v-else>
116
+        <emptyDataVue style="top: 0" />
65 117
       </template>
66 118
       <view
67 119
         class=""
@@ -71,6 +123,70 @@
71 123
         —— 已经到最底部了哦 ——
72 124
       </view>
73 125
     </view>
126
+    <!-- 弹窗主体 -->
127
+    <uni-popup
128
+      ref="popup"
129
+      type="center"
130
+      :is-mask-click="false"
131
+      background-color="#rgba(0,0,0,0.5)"
132
+    >
133
+      <view class="popup-container" :class="[isOpen ? 'popup-show' : '']">
134
+        <!-- 标题区 -->
135
+        <view class="popup-header">
136
+          <text class="title">活动设置</text>
137
+        </view>
138
+        <!-- 内容区 -->
139
+        <view class="content-wrapper">
140
+          <view class="form-item">
141
+            <uni-data-checkbox
142
+              mode="button"
143
+              icon="left"
144
+              v-model="formData.radio"
145
+              :localdata="rangeData"
146
+            ></uni-data-checkbox>
147
+          </view>
148
+          <!-- 秒杀区块 -->
149
+          <view class="form-item">
150
+            <uni-data-checkbox
151
+              mode="button"
152
+              icon="left"
153
+              v-model="formData.radios"
154
+              :localdata="rangeData1"
155
+              @change="onSwitchChange"
156
+            ></uni-data-checkbox>
157
+          </view>
158
+
159
+          <!-- 价格输入 -->
160
+          <view class="form-item">
161
+            <view class="item-label">秒杀价格</view>
162
+            <uni-easyinput
163
+              v-model="formData.seckill_price"
164
+              :errorMessage="isEmpty"
165
+              focus
166
+              placeholder="输入价格"
167
+              :adjust-position="false"
168
+              @change="changeInput"
169
+              type="digit"
170
+            ></uni-easyinput>
171
+          </view>
172
+          <!-- 时间选择 -->
173
+          <view class="form-item">
174
+            <view class="item-label">时间设置</view>
175
+            <uni-datetime-picker
176
+              type="datetime"
177
+              v-model="formData.seckill_date"
178
+              @change="onDateChange"
179
+            />
180
+          </view>
181
+        </view>
182
+
183
+        <!-- 操作按钮 -->
184
+        <view class="action-btns">
185
+          <button class="btn prev-step" @click="closePopup">取消</button>
186
+          <button class="btn submit-btn" @click="handleSubmit">提交</button>
187
+        </view>
188
+      </view>
189
+    </uni-popup>
74 190
   </view>
75 191
 </template>
76 192
 
@@ -79,14 +195,22 @@ import headersVue from "../components/headers/headers.vue";
79 195
 import searchVue from "./components/search/search.vue";
80 196
 import tabsVue from "./components/tablist.vue";
81 197
 import emptyDataVue from "../components/emptyData/emptyData.vue";
82
-import { getProductList, getGoodsTab } from "@/commit/product.js";
198
+import {
199
+  getProductList,
200
+  getGoodsTab,
201
+  changeshowApi,
202
+  destoryApi,
203
+  productDeleteApi,
204
+  productRestoreApi,
205
+  Addseckill, //活动
206
+} from "@/commit/product.js";
83 207
 //商品列表
84 208
 export default {
85 209
   components: {
86 210
     headersVue,
87 211
     searchVue,
88 212
     tabsVue,
89
-    emptyDataVue
213
+    emptyDataVue,
90 214
   },
91 215
 
92 216
   data() {
@@ -103,7 +227,7 @@ export default {
103 227
       type: 1,
104 228
       is_gift_bag: "",
105 229
       p_type: "",
106
-      isError:false,
230
+      isError: false,
107 231
       dataList: [
108 232
         {
109 233
           type: 1,
@@ -141,6 +265,21 @@ export default {
141 265
           count: 0,
142 266
         },
143 267
       ],
268
+      formData: {
269
+        radio: "1",
270
+        radios: "1",
271
+        seckill_price: "",
272
+        seckill_date: "",
273
+        product_id: "",
274
+      },
275
+      isOpen: false,
276
+      rangeData: [
277
+        { value: "1", text: "大仓活动" },
278
+        { value: "2", text: "平台活动" },
279
+      ],
280
+      rangeData1: [{ value: "1", text: "秒杀" }],
281
+      isEmpty: false,
282
+      dataObj: {},
144 283
     };
145 284
   },
146 285
   async onLoad(options) {
@@ -169,8 +308,15 @@ export default {
169 308
     }
170 309
   },
171 310
   methods: {
172
-    imgError(){
173
-      this.isError = true
311
+    async initData() {
312
+      await this.getGoodsTabData();
313
+      await this.getProductListData();
314
+    },
315
+    imgError() {
316
+      this.isError = true;
317
+    },
318
+    loadImage(e) {
319
+      // console.log(e,"loadImage")
174 320
     },
175 321
     headerJump() {
176 322
       uni.switchTab({ url: "/shop/productManagementModule/index" });
@@ -227,12 +373,225 @@ export default {
227 373
         uni.hideLoading();
228 374
       }
229 375
     },
230
-      async tabsHandleClick(obj) {
376
+    async tabsHandleClick(obj) {
231 377
       this.currentActive = obj.index;
232 378
       this.type = obj.item?.type || 1;
233
-
379
+      this.page = 1;
380
+      this.list = [];
381
+      this.is_panudn = true;
382
+      uni.pageScrollTo({ scrollTop: 0, duration: 0 });
234 383
       await this.getProductListData();
235 384
     },
385
+    async search(val) {
386
+      this.keyword = val;
387
+      // console.log(val)
388
+      await this.getProductListData();
389
+    },
390
+    async onHandleShow(item, type) {
391
+      const id = item.product_id;
392
+      const data = {
393
+        status: item.is_show,
394
+      };
395
+      const titleTips = item.is_show == 1 ? "商品下架中" : "商品上架中";
396
+      const titleMsg = item.is_show == 1 ? "商品下架成功" : "商品上架成功";
397
+      uni.showLoading({
398
+        title: titleTips,
399
+      });
400
+      try {
401
+        const res = await changeshowApi(id, data);
402
+        if (res.data.status == 200) {
403
+          uni.showToast({
404
+            title: titleMsg,
405
+            icon: "none",
406
+          });
407
+          await this.getProductListData();
408
+        }
409
+      } catch (error) {
410
+      } finally {
411
+        uni.hideLoading();
412
+        uni.hideToast();
413
+      }
414
+    },
415
+    /**删除 */
416
+    handleDelete(item, index) {
417
+      //  {{item.type === "5" ? "删除" : "加入回收站"}}
418
+      const req = this.type === "5" ? destoryApi : productDeleteApi;
419
+      const titleContent =
420
+        this.type === "5" ? "是否删除产品?" : "是否商品加入回收站中?";
421
+      const titleTips = this.type === "5" ? "商品删除中" : "商品加入回收站中";
422
+      const titleMsg =
423
+        this.type === "5" ? "商品删除成功" : "商品加入回收站成功";
424
+      const product_id = item.product_id;
425
+      const _this = this;
426
+      uni.showModal({
427
+        title: "温馨提示",
428
+        content: titleContent,
429
+        showCancel: true,
430
+        success: ({ confirm, cancel }) => {
431
+          if (confirm) {
432
+            uni.showLoading({
433
+              title: titleTips,
434
+            });
435
+            req(product_id)
436
+              .then((res) => {
437
+                if (res.data.status == 200) {
438
+                  uni.showToast({
439
+                    title: titleMsg,
440
+                    icon: "none",
441
+                  });
442
+                  this.list.splice(index, 1);
443
+                  _this.initData();
444
+                }
445
+              })
446
+              .finally(() => {
447
+                uni.hideLoading();
448
+                uni.hideToast();
449
+              });
450
+          } else if (cancel) {
451
+          }
452
+        },
453
+      });
454
+    },
455
+    //恢复产品
456
+    handleRestore(id) {
457
+      const _this = this;
458
+      const titleTips = "商品恢复中";
459
+      const titleMsg = "商品恢复成功";
460
+      const product_id = id;
461
+      uni.showModal({
462
+        title: "温馨提示",
463
+        content: "是否恢复商品?",
464
+        showCancel: true,
465
+        success: ({ confirm, cancel }) => {
466
+          if (confirm) {
467
+            uni.showLoading({
468
+              title: titleTips,
469
+            });
470
+            productRestoreApi(product_id)
471
+              .then((res) => {
472
+                if (res.data.status == 200) {
473
+                  uni.showToast({
474
+                    title: titleMsg,
475
+                    icon: "none",
476
+                  });
477
+                  _this.initData();
478
+                }
479
+              })
480
+              .finally(() => {
481
+                uni.hideLoading();
482
+                uni.hideToast();
483
+              });
484
+          } else if (cancel) {
485
+          }
486
+        },
487
+      });
488
+    },
489
+    huodong(item) {
490
+      this.dataObj = item;
491
+      const _this = this;
492
+      if (item.seckill == 1 && this.type !=2) {
493
+        uni.showModal({
494
+          title: "温馨提示",
495
+          content: "此商品正在处于秒杀状态,请勿操作",
496
+          showCancel: false,
497
+          success: ({ confirm, cancel }) => {},
498
+        });
499
+        return;
500
+      }
501
+       _this.showPopup()
502
+      // Addseckill({}).then(data=>{
503
+      //   console.log(data)
504
+      // }).catch((res) => {
505
+      //   console.log(res);
506
+      //   if (res.data.message == "没有权限访问") {
507
+      //     uni.showToast({
508
+      //       title: res.data.message || "没有权限访问",
509
+      //       icon: "none",
510
+      //     });
511
+      //   } else {
512
+      //     _this.showPopup();
513
+      //   }
514
+      // });
515
+    },
516
+    showPopup() {
517
+      this.isOpen = true;
518
+      this.$refs.popup.open();
519
+    },
520
+    closePopup() {
521
+      this.isOpen = false;
522
+      this.formData.radio = "1";
523
+      this.formData.radios = "1";
524
+      this.formData.seckill_price = "";
525
+      this.formData.seckill_date = "";
526
+      this.$refs.popup.close();
527
+    },
528
+    onDateChange(data) {
529
+      this.formData.seckill_date = data;
530
+    },
531
+    convertToISOString(dateStr) {
532
+      // 将输入的日期时间字符串中的空格替换为 'T',以符合 ISO 8601 格式
533
+      const isoFormatStr = dateStr.replace(" ", "T");
534
+      // 创建 Date 对象
535
+      const date = new Date(isoFormatStr);
536
+      // 将 Date 对象转换为 ISO 8601 格式的字符串
537
+      return date.toISOString();
538
+    },
539
+    async handleSubmit() {
540
+      // 提交逻辑
541
+      this.formData.product_id = this.dataObj.product_id;
542
+      let params = JSON.parse(JSON.stringify(this.formData));
543
+
544
+      if (
545
+        params.seckill_price == "" ||
546
+        params.seckill_price == null ||
547
+        params.seckill_price == undefined
548
+      ) {
549
+        uni.showToast({
550
+          title: "请输入秒杀价格",
551
+          icon: "none",
552
+        });
553
+        this.isEmpty = true;
554
+        return;
555
+      }
556
+      if (
557
+        params.seckill_date == "" ||
558
+        params.seckill_date == null ||
559
+        params.seckill_date == undefined
560
+      ) {
561
+        uni.showToast({
562
+          title: "请选择秒杀时间",
563
+          icon: "none",
564
+        });
565
+        return;
566
+      }
567
+      params.seckill_date = this.convertToISOString(params.seckill_date);
568
+
569
+      this.isEmpty = false;
570
+      uni.showLoading({
571
+        title: "秒杀活动添加中",
572
+      });
573
+      console.log(params);
574
+      try {
575
+        const res = await Addseckill(params);
576
+        if (res.data.status == 200) {
577
+          uni.showToast({
578
+            title: "秒杀活动添加成功",
579
+            icon: "none",
580
+          });
581
+          this.closePopup();
582
+          this.initData();
583
+        }
584
+      } catch (error) {
585
+      } finally {
586
+        uni.hideLoading();
587
+        uni.hideToast();
588
+      }
589
+    },
590
+    changeInput(val) {
591
+      if (val) {
592
+        this.isEmpty = false;
593
+      }
594
+    },
236 595
   },
237 596
 };
238 597
 </script>
@@ -339,6 +698,10 @@ page {
339 698
             flex: 40%;
340 699
             .title {
341 700
               padding-right: 16rpx;
701
+              font-size: 26rpx;
702
+            }
703
+            .mdikd {
704
+              font-size: 26rpx;
342 705
             }
343 706
           }
344 707
           .list-card-top--right-price {
@@ -365,20 +728,111 @@ page {
365 728
           gap: 20rpx;
366 729
           user-select: none;
367 730
           .list-card-bottom-btn-list--item {
731
+            flex: 1;
368 732
             display: flex;
369 733
             justify-content: center;
370 734
             align-items: center;
735
+            flex-wrap: wrap;
371 736
             width: 146rpx;
737
+            white-space: nowrap;
372 738
             height: 60rpx;
373
-            border-radius: 8rpx;
374
-            border: 1rpx solid #e5e5e5;
739
+            // border: 1rpx solid #e5e5e5;
375 740
             font-weight: 400;
376 741
             font-size: 24rpx;
742
+            border-radius: 12rpx;
377 743
             color: #333333;
744
+            transition: all 0.2s;
745
+
746
+            &.edit-price {
747
+              background: #fff;
748
+              color: #007aff;
749
+              // border: 1rpx solid #007aff;
750
+            }
751
+
752
+            &.set-activity {
753
+              background: #007aff;
754
+              color: white;
755
+            }
756
+            &.delete-activity {
757
+              background: #f15314;
758
+              color: white;
759
+            }
760
+            &.bohui-activity {
761
+              background: #e9ca1d;
762
+              color: white;
763
+            }
764
+
765
+            &:active {
766
+              opacity: 0.8;
767
+              transform: scale(0.98);
768
+            }
378 769
           }
379 770
         }
380 771
       }
381 772
     }
382 773
   }
383 774
 }
775
+.popup-container {
776
+  width: 80vw;
777
+  background: #ffffff;
778
+  border-radius: 16rpx;
779
+  transition: all 0.3s ease;
780
+  transform: scale(0.8);
781
+  opacity: 0;
782
+  padding: 20rpx;
783
+  .popup-header {
784
+    padding: 0rpx 15rpx 15rpx;
785
+    border-bottom: 1px solid #eee;
786
+    .title {
787
+      font-size: 36rpx;
788
+      font-weight: 600;
789
+      color: #333;
790
+      text-align: center;
791
+    }
792
+  }
793
+}
794
+.content-wrapper {
795
+  overflow: auto;
796
+  .form-item {
797
+    padding: 15rpx 0;
798
+    .item-label {
799
+      font-size: 28rpx;
800
+      font-weight: 600;
801
+      color: #333;
802
+      margin-bottom: 12rpx;
803
+    }
804
+  }
805
+}
806
+.popup-show {
807
+  transform: scale(1);
808
+  opacity: 1;
809
+}
810
+.action-btns {
811
+  display: flex;
812
+  padding: 24rpx;
813
+  gap: 20rpx;
814
+  border-top: 1px solid #eee;
815
+
816
+  .btn {
817
+    flex: 1;
818
+    height: 80rpx;
819
+    line-height: 80rpx;
820
+    border-radius: 8rpx;
821
+    font-size: 28rpx;
822
+
823
+    &.prev-step {
824
+      background: #f8f8f8;
825
+      color: #666;
826
+    }
827
+
828
+    &.submit-btn {
829
+      background: #007aff;
830
+      color: white;
831
+    }
832
+  }
833
+}
834
+
835
+/deep/.uni-popup {
836
+  z-index: 667;
837
+}
384 838
 </style>

BIN
static/images/new_ui/wutu.png