xiaohaizhao 1 rok pred
rodič
commit
9d6c1ed987
1 zmenil súbory, kde vykonal 61 pridanie a 54 odobranie
  1. 61 54
      cloud/serviceAdmin/redskinsServiceAdmin.vue

+ 61 - 54
cloud/serviceAdmin/redskinsServiceAdmin.vue

@@ -1,77 +1,82 @@
 <template>
-    <view>
-      <My_listbox ref="listRef" @getlist="getList" bottomHeight="30">
-        <view class="border-style" v-for="item in list" :key="item.rowindex">
-          <view style="padding: 10px">
-            <view class="content-style">
-              <u--image :src="item.attinfos[0].url" :width="tovw(355)" :height="tovw(180)"   :lazy-load="true">
-                <template v-slot:loading>
-                  <u-loading-icon color="red"></u-loading-icon>
-                </template>
-              </u--image>
-            </view>
+  <view>
+    <My_listbox ref="listRef" @getlist="getList" bottomHeight="30">
+      <view class="border-style" v-for="(item, index) in list" :key="item.rowindex">
+        <view style="padding: 10px">
+          <view class="content-style">
+            <u--image :src="item.attinfos[0].url" :width="tovw(355)" :height="tovw(180)" :lazy-load="true">
+              <template v-slot:loading>
+                <u-loading-icon color="red"></u-loading-icon>
+              </template>
+            </u--image>
           </view>
-          <view class="button-style">
-            <view>
-              <span style="color: #666666;font-size: 14px">状态:</span>
-              <span :style="{color: item.isonsale=='1'?'#E3041F':'#999999',fontSize: '14px'}">{{item.isonsale == '1'?'上架':'下架'}}</span>
-            </view>
-            <view style="width: 100px;height: 40px;line-height: 40px;margin-top:5px;vertical-align: middle">
-              <u-button :text="item.isonsale == '0'?'上架':'下架'" :color="item.isonsale == '0'?'#C30D23':'#999999'" @click="clickSale(item)" :loading="loading == item.linksid"></u-button>
-            </view>
+        </view>
+        <view class="button-style">
+          <view>
+            <span style="color: #666666;font-size: 14px">状态:</span>
+            <span :style="{ color: item.isonsale == '1' ? '#E3041F' : '#999999', fontSize: '14px' }">{{ item.isonsale ==
+              '1' ? '上架' : '下架' }}</span>
+          </view>
+          <view style="width: 100px;height: 40px;line-height: 40px;margin-top:5px;vertical-align: middle">
+            <u-button :text="item.isonsale == '0' ? '上架' : '下架'" :color="item.isonsale == '0' ? '#C30D23' : '#999999'"
+              @click="clickSale(item, index)" :loading="loading == item.linksid"></u-button>
           </view>
         </view>
-      </My_listbox>
-    </view>
+      </view>
+    </My_listbox>
+  </view>
 </template>
 
 <script>
 export default {
-  data(){
+  data() {
     return {
-      list:[],
-      loading:null,
+      list: [],
+      loading: null,
       current: 0,
       "content": {
-        "title":''
+        "title": ''
       },
     }
   },
-  onLoad(options){
+  onLoad(options) {
     this.getList(true)
-    if (options.title){
+    if (options.title) {
       this.title = options.title
     }
     uni.setNavigationBarTitle({
-      title:'6C红人服务管理'
+      title: '6C红人服务管理'
     })
   },
-  methods:{
-    getList(init = false){
-      this.content.title = this.title?this.title:"6C红人服务"
+  methods: {
+    getList(init = false) {
+      this.content.title = this.title ? this.title : "6C红人服务"
       if (this.paging(this.content, init)) return;
       this.$Http.basic({
         "id": 20240511110302,
         "content": this.content
-      }).then(res =>{
+      }).then(res => {
         this.$refs.listRef.RefreshToComplete()
         if (this.cutoff(res.msg)) return
-        this.list = res.pageNumber == 1? res.data:this.list.concat(res.data)
+        this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data)
         this.content = this.$refs.listRef.paging(this.content, res)
       })
     },
-    clickSale(item){
+    clickSale(item) {
       this.loading = item.linksid
+      item.isonsale = item.isonsale == '1' ? '0' : '1'
       this.$Http.basic({
         "id": 20240511133302,
         "content": {
           "linksids": [item.linksid],
-          "isonsale":item.isonsale == '1'?0:1
+          "isonsale": item.isonsale
         },
-      }).then(res =>{
+      }).then(res => {
+        console.log("更改上下架", res)
         if (this.cutoff(res.msg)) return
         this.loading = null
-        this.getList(true)
+        this.list[index] = item;
+        // this.getList(true)
       })
     }
   }
@@ -79,22 +84,24 @@ export default {
 </script>
 
 <style lang="scss">
-  .border-style{
-    height: 255px;
-    background: #FFFFFF;
-    border-radius: 0px 0px 0px 0px;
-    margin-bottom: 10px;
-    .content-style {
-      height: 180px;
-      border: 0px solid #707070;
-    }
-    .button-style {
-      padding: 0 10px 10px 10px ;
-      height: 45px;
-      line-height: 45px;
-      vertical-align: center;
-      display: flex;
-      justify-content: space-between;
-    }
+.border-style {
+  height: 255px;
+  background: #FFFFFF;
+  border-radius: 0px 0px 0px 0px;
+  margin-bottom: 10px;
+
+  .content-style {
+    height: 180px;
+    border: 0px solid #707070;
+  }
+
+  .button-style {
+    padding: 0 10px 10px 10px;
+    height: 45px;
+    line-height: 45px;
+    vertical-align: center;
+    display: flex;
+    justify-content: space-between;
   }
+}
 </style>