Przeglądaj źródła

产品需求单

panhui 5 lat temu
rodzic
commit
be8a6d4425

+ 3 - 2
.env.development

@@ -1,3 +1,4 @@
-VUE_APP_BASE_URL=http://localhost:8080
+VUE_APP_BASE_URL=http://192.168.50.104:8080
 VUE_APP_PHONE=862160797117
-VUE_APP_EMAIL=imttech@itoc.com.cn
+VUE_APP_EMAIL=imttech@itoc.com.cn
+VUE_APP_PRODUCTSTATUS=PENDING_REVIEW,NOW_ON_SHELF

+ 2 - 1
.env.production

@@ -1,3 +1,4 @@
 VUE_APP_BASE_URL=https://www.imttech.cn
 VUE_APP_PHONE=862160797117
-VUE_APP_EMAIL=imttech@itoc.com.cn
+VUE_APP_EMAIL=imttech@itoc.com.cn
+VUE_APP_PRODUCTSTATUS=NOW_ON_SHELF

+ 3 - 3
project.config.json

@@ -109,9 +109,9 @@
                 },
                 {
                     "id": -1,
-                    "name": "活动信息",
-                    "pathName": "pagesNews/Submit",
-                    "query": "infoId=23151&activityId=26963",
+                    "name": "清单",
+                    "pathName": "pagesMine/Order",
+                    "query": "",
                     "scene": null
                 },
                 {

+ 3 - 2
src/components/AuthPhone.vue

@@ -66,8 +66,9 @@ export default {
                         if (res) {
                             this.$http.setToken(res);
                         }
-                        this.$store.dispatch('getUserInfo');
-                        this.navigateBack();
+                        this.$store.dispatch('getUserInfo').then(() => {
+                            this.navigateBack();
+                        });
                     });
             }
         },

+ 3 - 1
src/components/Order.vue

@@ -52,7 +52,9 @@ export default {
             }
         },
         productCategory() {
-            if (this.info.productCategory) {
+            if (this.info.type === 'OWN_PRODUCT') {
+                return this.info.customCategory || '';
+            } else if (this.info.productCategory) {
                 return this.getName(this.info.productCategory);
             } else {
                 return '';

+ 2 - 1
src/locales/zh.json

@@ -273,5 +273,6 @@
   "qing-xuan-ze-chan-pin-lei-bie": "请选择产品类别",
   "qing-xuan-ze-ying-yong-ling-yu": "请选择应用领域",
   "qing-shu-ru-chan-pin-miao-shu": "请输入产品描述",
-  "xin-zeng-cheng-gong": "新增成功"
+  "xin-zeng-cheng-gong": "新增成功",
+  "qing-shu-ru-chan-pin-lei-bie": "请输入产品类别"
 }

+ 35 - 0
src/mixins/commont.js

@@ -153,6 +153,41 @@ export default {
                     'http://imttech.oss-cn-hangzhou.aliyuncs.com/micro/shareIcon.png' +
                     '?x-oss-process=image/resize,m_pad,h_400,w_500,color_FFFFFF'
             };
+        },
+        checkLoginNum() {
+            if (!this.$store.state.userInfo) {
+                wx.getStorage({
+                    key: 'freePage',
+                    success: res => {
+                        if (res.data > 5) {
+                            Dialog.confirm({
+                                title: this.$t('ti-shi'),
+                                message: '未登录用户只有五次查看权限!',
+                                confirmButtonColor: this.$colors.warn,
+                                confirmButtonText: '立即登录'
+                            })
+                                .then(() => {
+                                    wx.navigateTo({
+                                        url: '/pagesHome/Authorized'
+                                    });
+                                })
+                                .catch(e => {
+                                    wx.navigateBack();
+                                });
+                        }
+                        wx.setStorage({
+                            key: 'freePage',
+                            data: res.data + 1
+                        });
+                    },
+                    fail: e => {
+                        wx.setStorage({
+                            key: 'freePage',
+                            data: 1
+                        });
+                    }
+                });
+            }
         }
     }
 };

+ 4 - 0
src/mixins/searchList.js

@@ -109,6 +109,10 @@ export default {
 
                     this.loading = false;
                     this.$loading.close();
+
+                    if (this.endLoading) {
+                        this.endLoading();
+                    }
                 })
                 .catch(e => {
                     this.list = [];

+ 37 - 8
src/pages/Chat.vue

@@ -19,19 +19,20 @@
                     @touchend="touchEndEvent($event, item.otherUserId)"
                     :x="moveInfo[item.otherUserId]"
                     class="move-view"
-                    out-of-bounds
                     inertia
                 >
                     <member :info="item"></member>
-                    <div class="del">删除</div>
+                    <div class="del" @click="del(item.otherUserId)">删除</div>
                 </movable-view>
             </movable-area>
         </block>
+        <van-dialog id="van-dialog" />
     </div>
 </template>
 <script>
 import Member from '../components/Member.vue';
 import { mapState } from 'vuex';
+import Dialog from '../native/vant/dialog/dialog';
 export default {
     components: { Member },
     data() {
@@ -90,10 +91,14 @@ export default {
         }
     },
     methods: {
-        setMove() {
+        setMove(extraId) {
             const info = {};
             [...this.showList].forEach(item => {
-                info[item.otherUserId] = 60;
+                if (extraId !== item.otherUserId) {
+                    info[item.otherUserId] = 60;
+                } else {
+                    info[extraId] = this.moveInfo[extraId];
+                }
             });
             this.moveInfo = {
                 ...info
@@ -103,7 +108,6 @@ export default {
             this.$store.dispatch('getUnreadNumber');
         },
         touchStartEvent(e, id) {
-            this.setMove();
             this.touchMap.set(id, {
                 startX: e.changedTouches[0].clientX
             });
@@ -111,9 +115,11 @@ export default {
         touchEndEvent(e, id) {
             if (this.touchMap.has(id)) {
                 const touchInfo = this.touchMap.get(id);
-                this.moveX = e.changedTouches[0].clientX < touchInfo.startX ? 0 : 60;
-
-                this.moveInfo[id] = e.changedTouches[0].clientX < touchInfo.startX ? 0 : 60;
+                if (touchInfo.source) {
+                    this.setMove(id);
+                    this.moveX = e.changedTouches[0].clientX < touchInfo.startX ? 0 : 60;
+                    this.moveInfo[id] = e.changedTouches[0].clientX < touchInfo.startX ? 0 : 60;
+                }
             }
         },
         touchMoveEvent(e, id) {
@@ -121,6 +127,29 @@ export default {
                 ...this.touchMap.get(id),
                 ...e.detail
             });
+        },
+        del(id) {
+            Dialog.confirm({
+                title: this.$t('ti-shi'),
+                message: '确定要删除该咨询消息吗?',
+                confirmButtonColor: this.$colors.warn,
+                confirmButtonText: '删除'
+            })
+                .then(() => {
+                    return this.$http.post('/message/delBox?otherUserId=' + id);
+                })
+                .then(() => {
+                    this.toast('删除成功!', 'success');
+                    this.loginMethods();
+                })
+                .catch(e => {
+                    // on cancel
+                    if (e.error) {
+                        this.toast(e.error);
+                    } else {
+                        this.moveInfo[id] = 60;
+                    }
+                });
         }
     },
     onShareAppMessage(from, target) {

+ 43 - 12
src/pagesMine/Order.vue

@@ -10,15 +10,16 @@
         <van-sticky>
             <div class="top">
                 <div class="tabs">
-                    <div
-                        class="tab"
-                        @click="chooseTab(item.key)"
-                        :class="{ active: type === item.key }"
-                        v-for="item in productListType"
-                        :key="item.key"
+                    <block v-for="(item, index) in productListType" :key="index">
+                        <div
+                            class="tab"
+                            v-if="!(noOwn && item.key === 'OWN_PRODUCT')"
+                            @click="chooseTab(item.key)"
+                            :class="{ active: type === item.key }"
+                        >
+                            {{ $t(item.name) }}
+                        </div></block
                     >
-                        {{ $t(item.name) }}
-                    </div>
                 </div>
 
                 <!-- <van-button size="small" :color="$colors.warn" plain>编辑</van-button> -->
@@ -35,8 +36,18 @@
             <div class="order-list">
                 <order v-for="(item, index) in list" :index="index" :key="item.id" :info="item"></order>
             </div>
-            <template slot="emptyButton">
+            <fixed-button v-if="!empty && !(isVendor && type === 'OWN_PRODUCT')">
                 <van-button block :color="$colors.warn" @click="navigateTo('/pagesMine/OrderDetail?type=' + type)">
+                    新增
+                </van-button>
+            </fixed-button>
+            <template slot="emptyButton">
+                <van-button
+                    v-if="!(isVendor && type === 'OWN_PRODUCT')"
+                    block
+                    :color="$colors.warn"
+                    @click="navigateTo('/pagesMine/OrderDetail?type=' + type)"
+                >
                     {{ $t('xin-zeng') }}
                 </van-button>
             </template>
@@ -49,8 +60,9 @@ import searchList from '../mixins/searchList';
 import SortList from '../components/SortList.vue';
 import { mapState } from 'vuex';
 import Order from '../components/Order.vue';
+import FixedButton from '../components/FixedButton.vue';
 export default {
-    components: { SortList, Order },
+    components: { SortList, Order, FixedButton },
     data() {
         return {
             url: '/productList/all',
@@ -59,7 +71,9 @@ export default {
                 header: {
                     'Content-Type': 'application/json'
                 }
-            }
+            },
+            isVendor: false,
+            noOwn: false
         };
     },
     mixins: [searchList],
@@ -77,7 +91,8 @@ export default {
             return {
                 query: {
                     userId: this.userInfo ? this.userInfo.id : '',
-                    type: this.type
+                    type: this.type,
+                    del: false
                 }
             };
         },
@@ -88,9 +103,19 @@ export default {
     onShow() {
         const app = getApp();
         if (app.globalData.initialize) {
+            if (this.$store.state.userInfo.identity !== 'BUYERS') {
+                this.isVendor = true;
+            } else {
+                this.isVendor = false;
+            }
             this.getData();
         } else {
             app.globalData.initializeCallback = () => {
+                if (this.$store.state.userInfo.identity !== 'BUYERS') {
+                    this.isVendor = true;
+                } else {
+                    this.isVendor = false;
+                }
                 this.getData();
             };
         }
@@ -106,6 +131,12 @@ export default {
                 this.type = type;
                 this.refreash();
             }
+        },
+        endLoading() {
+            if (this.empty && this.type === 'OWN_PRODUCT' && this.isVendor) {
+                this.chooseTab('REQUIRED_PRODUCT');
+                this.noOwn = true;
+            }
         }
     },
     onReachBottom() {

+ 46 - 7
src/pagesMine/OrderDetail.vue

@@ -9,7 +9,7 @@
             <h3>{{ $t('xuan-ze-xin-zeng-qing-dan-lei-xing') }}</h3>
             <div class="page-input" @click="chooseType">
                 <span class="text">{{ typeName }}</span>
-                <van-icon name="arrow" color="#CACFDB" :size="24" />
+                <van-icon v-if="!form.id" name="arrow" color="#CACFDB" :size="24" />
             </div>
         </div>
         <div class="page-info">
@@ -44,7 +44,23 @@
             </div>
         </div>
 
-        <div class="page-info">
+        <div class="page-info" v-if="form.type === 'OWN_PRODUCT'">
+            <h3>{{ $t('chan-pin-lei-bie') }}</h3>
+            <div class="page-input">
+                <input
+                    type="text"
+                    @input="form.customCategory = $event.detail.value"
+                    @confirm="form.customCategory = $event.detail.value"
+                    @blur="form.customCategory = $event.detail.value"
+                    :value="form.customCategory"
+                    class="text"
+                    :placeholder="$t('qing-shu-ru-chan-pin-lei-bie')"
+                    placeholder-class="pla-textarea"
+                />
+            </div>
+        </div>
+
+        <div class="page-info" v-else>
             <h3>{{ $t('chan-pin-lei-bie') }}</h3>
             <div class="page-input" @click="$refs.productCategory.show()">
                 <div class="text">
@@ -103,10 +119,12 @@ export default {
                 name: '',
                 brand: '',
                 model: '',
+                customCategory: '',
                 productCategoryId: '',
                 applicationField: [],
                 introduction: ''
-            }
+            },
+            isVendor: false
         };
     },
     computed: {
@@ -133,6 +151,11 @@ export default {
         }
     },
     onLoad(options) {
+        if (this.$store.state.userInfo.identity !== 'BUYERS') {
+            this.isVendor = true;
+        } else {
+            this.isVendor = false;
+        }
         if (options.id) {
             this.orderId = options.id;
             this.$http
@@ -152,13 +175,25 @@ export default {
     },
     methods: {
         chooseType() {
-            const _list = [...productListType.values()].map(item => {
-                return this.$t(item);
+            if (this.form.id) {
+                return;
+            }
+            const types = [...productListType].filter(item => {
+                if (this.isVendor && item[0] === 'OWN_PRODUCT') {
+                    return false;
+                } else {
+                    return true;
+                }
+            });
+            const _list = [...types].map(item => {
+                console.log(item);
+
+                return this.$t(item[1]);
             });
             wx.showActionSheet({
                 itemList: _list,
                 success: res => {
-                    this.form.type = [...productListType.keys()][res.tapIndex];
+                    this.form.type = [...types][res.tapIndex][0];
                 },
                 fail: res => {
                     console.log(res.errMsg);
@@ -175,7 +210,11 @@ export default {
                 this.toast(this.$t('qing-shu-ru-pin-pai-ming-cheng'));
                 return;
             }
-            if (!form.productCategoryId) {
+            if (this.form.type === 'OWN_PRODUCT' && !form.customCategory) {
+                this.toast('请输入产品类别');
+                return;
+            }
+            if (this.form.type !== 'OWN_PRODUCT' && !form.productCategoryId) {
                 this.toast(this.$t('qing-xuan-ze-chan-pin-lei-bie'));
                 return;
             }

+ 5 - 0
src/pagesProduct/Detail.vue

@@ -181,6 +181,7 @@
                 </div>
             </div>
         </div>
+        <van-dialog id="van-dialog" />
     </div>
 </template>
 <script>
@@ -190,6 +191,7 @@ import CustomBar from '../components/bar/CustomBar.vue';
 import Parameter from '../components/product/Parameter.vue';
 import { mapState } from 'vuex';
 import { saveBrowse } from '../utils/commont';
+import Dialog from '../native/vant/dialog/dialog';
 export default {
     components: { CustomBar, Banner, Parameter },
     data() {
@@ -329,6 +331,9 @@ export default {
             }
         }
     },
+    onShow() {
+        this.checkLoginNum();
+    },
     onPageScroll(e) {
         if (e.scrollTop > this.detailTop - this.screenHeight + 300) {
             this.showBtn = true;

+ 5 - 0
src/pagesVendor/Detail.vue

@@ -92,6 +92,7 @@
                 >咨询展商</van-button
             >
         </fixed-button>
+        <van-dialog id="van-dialog" />
     </div>
 </template>
 <script>
@@ -102,6 +103,7 @@ import About from './About.vue';
 import Product from './Product.vue';
 import News from './News.vue';
 import { mapState } from 'vuex';
+import Dialog from '../native/vant/dialog/dialog';
 
 export default {
     components: { SearchBar, About, Product, FixedButton, News },
@@ -196,6 +198,9 @@ export default {
             });
         });
     },
+    onShow() {
+        this.checkLoginNum();
+    },
     onReady() {
         this.main = wx.createSelectorQuery().select('#main');
         this.main

+ 2 - 1
src/pagesVendor/FilterProduct.vue

@@ -54,7 +54,8 @@ export default {
                     '/product/all',
                     {
                         query: {
-                            vendorInfoId: this.vendorId
+                            vendorInfoId: this.vendorId,
+                            deviceStatus: process.env.VUE_APP_PRODUCTSTATUS.split(',')
                         }
                     },
                     {

+ 4 - 2
src/utils/appState.js

@@ -51,7 +51,8 @@ const InformationType = new Map([
     [
         'INDUSTRY_NEWS',
         {
-            name: 'hang-ye-xin-wen'
+            name: 'hang-ye-xin-wen',
+            type: 'bigImg'
         }
     ],
     [
@@ -71,7 +72,8 @@ const InformationType = new Map([
     [
         'POLICY_INFORMATION',
         {
-            name: 'zheng-ce-xin-xi'
+            name: 'zheng-ce-xin-xi',
+            type: 'bigImg'
         }
     ],
     [