Authored by Tao

modify news && newsDetail last pages2

@@ -54,9 +54,6 @@ export default { @@ -54,9 +54,6 @@ export default {
54 data() { 54 data() {
55 return { 55 return {
56 options: { 56 options: {
57 - // bounce: {  
58 - // top: false  
59 - // },  
60 scrollbar: true, 57 scrollbar: true,
61 pullUpLoad: true, 58 pullUpLoad: true,
62 pullDownRefresh: true, 59 pullDownRefresh: true,
@@ -90,7 +87,7 @@ export default { @@ -90,7 +87,7 @@ export default {
90 searchParams: { 87 searchParams: {
91 type: 0, // type:0,推荐;1,热销;2,即将发售; 3,品类; 4,品牌;5,系列;6,搜索 7, 收藏 88 type: 0, // type:0,推荐;1,热销;2,即将发售; 3,品类; 4,品牌;5,系列;6,搜索 7, 收藏
92 order: '', // 指定排序 89 order: '', // 指定排序
93 - productPool: null, // 商品池id 90 + productPool: null, // 商品池idfetchList
94 sort: null, // 品类id 91 sort: null, // 品类id
95 brand: null, // 品牌id 92 brand: null, // 品牌id
96 series: null, // 系列id 93 series: null, // 系列id
@@ -178,7 +175,7 @@ export default { @@ -178,7 +175,7 @@ export default {
178 return; 175 return;
179 } 176 }
180 if (typeof params === 'object' && Object.keys(params)) { 177 if (typeof params === 'object' && Object.keys(params)) {
181 - searchParams ={...params}; 178 + searchParams = {...params};
182 this.searchParams = searchParams; 179 this.searchParams = searchParams;
183 } 180 }
184 181
@@ -198,7 +195,7 @@ export default { @@ -198,7 +195,7 @@ export default {
198 195
199 if (result.code === 200) { 196 if (result.code === 200) {
200 197
201 - data.endReached = (data.page === data.page_total) && (data.page_size !== 1); 198 + data.endReached = (data.page === data.page_total) && (data.page_size !== 1) || !data.page_total;
202 } 199 }
203 200
204 if (typeof data === 'object' && Object.keys(data).length) { 201 if (typeof data === 'object' && Object.keys(data).length) {
@@ -10,14 +10,9 @@ @@ -10,14 +10,9 @@
10 </template> 10 </template>
11 11
12 <script> 12 <script>
13 -import Vue from 'vue'  
14 import { Style, ScrollNavBar } from 'cube-ui'; 13 import { Style, ScrollNavBar } from 'cube-ui';
15 -import { createNamespacedHelpers } from 'vuex';  
16 import queryString from 'query-string'; 14 import queryString from 'query-string';
17 15
18 -// const { mapState, mapActions } = createNamespacedHelpers('list/channel');  
19 -const {mapState, mapActions} = createNamespacedHelpers('list');  
20 -  
21 export default { 16 export default {
22 name: 'slide', 17 name: 'slide',
23 props: { 18 props: {
@@ -28,39 +23,38 @@ export default { @@ -28,39 +23,38 @@ export default {
28 current: { 23 current: {
29 type: Number, 24 type: Number,
30 default: true 25 default: true
31 - } 26 + },
32 }, 27 },
33 data() { 28 data() {
34 return { 29 return {
35 index: 0, 30 index: 0,
36 - // current: this.list[0].title, 31 +
37 labels: [], 32 labels: [],
38 - } 33 + };
39 }, 34 },
40 components: { 35 components: {
41 Style, 36 Style,
42 ScrollNavBar 37 ScrollNavBar
43 }, 38 },
44 - computed: {  
45 - ...mapState(['productList']),  
46 - },  
47 mounted() { 39 mounted() {
48 - this.list.map((res) => { this.labels.push(res.title) }); 40 + this.list.map((res) => {
  41 + this.labels.push(res.title);
  42 + });
49 }, 43 },
50 created() { 44 created() {
51 45
52 }, 46 },
53 methods: { 47 methods: {
54 - ...mapActions(['fetchProductList']),  
55 changeHandler(cur) { 48 changeHandler(cur) {
56 let index = this.$refs[`getindex${cur}`].innerText; 49 let index = this.$refs[`getindex${cur}`].innerText;
57 - let url = this.list[index].url.split("?"); 50 + let url = this.list[index].url.split('?');
58 let urlParams = queryString.parse(url[1]); 51 let urlParams = queryString.parse(url[1]);
59 let params = urlParams; 52 let params = urlParams;
  53 +
60 params.isReset = true; 54 params.isReset = true;
61 - this.fetchProductList(params);  
62 - this.$emit('transfer',index);  
63 - console.log(params) 55 + console.log(this.$parent);
  56 + this.$parent.$parent.$parent.fetchList && this.$parent.$parent.$parent.fetchList(params);
  57 + this.$emit('transfer', index);
64 } 58 }
65 } 59 }
66 }; 60 };
@@ -156,7 +156,7 @@ export default { @@ -156,7 +156,7 @@ export default {
156 156
157 if (result.code === 200) { 157 if (result.code === 200) {
158 158
159 - data.endReached = (data.page === data.page_total) && (data.page_size !== 1); 159 + data.endReached = (data.page === data.page_total) && (data.page_size !== 1) || !data.page_total;
160 } 160 }
161 161
162 if (typeof data === 'object' && Object.keys(data).length) { 162 if (typeof data === 'object' && Object.keys(data).length) {
@@ -14,9 +14,15 @@ @@ -14,9 +14,15 @@
14 <div class="productPrice"> 14 <div class="productPrice">
15 <span class="size">{{sizeInfo}}</span> 15 <span class="size">{{sizeInfo}}</span>
16 <div class="pricedetail"> 16 <div class="pricedetail">
  17 + <div>
17 <span class="priceTitle">最低售价: </span> 18 <span class="priceTitle">最低售价: </span>
18 <span class="price">{{originProductData.least_price || '-'}}</span> 19 <span class="price">{{originProductData.least_price || '-'}}</span>
19 </div> 20 </div>
  21 + <div>
  22 + <span class="priceTitle">最高求购价: </span>
  23 + <span class="price">{{originProductData.bid_moster_price || '-'}}</span>
  24 + </div>
  25 + </div>
20 </div> 26 </div>
21 </div> 27 </div>
22 <div class="inputView"> 28 <div class="inputView">
@@ -97,7 +103,7 @@ export default { @@ -97,7 +103,7 @@ export default {
97 return { 103 return {
98 inputPrice: '', 104 inputPrice: '',
99 isAgreeTerms: false, 105 isAgreeTerms: false,
100 - url: `http://m.yohobuy.com/activity/student/detail/renzhen?openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"url\":\"https://activity.yoho.cn/feature/3189.html?title=买家协议&promiseV="}}`, 106 + url: 'http://m.yohobuy.com/activity/student/detail/renzhen?openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"url\":\"https://activity.yoho.cn/feature/3189.html?title=买家协议&promiseV="}}',
101 agreeDesc: '有货买家协议' 107 agreeDesc: '有货买家协议'
102 }; 108 };
103 }, 109 },
@@ -128,14 +134,24 @@ export default { @@ -128,14 +134,24 @@ export default {
128 134
129 }, 135 },
130 136
  137 + beforeRouteEnter (to, from, next) {
  138 +
  139 + next(vm => {
  140 + // 通过 `vm` 访问组件实例
  141 + vm.inputPrice = '';
  142 + vm.BUYER_ASK_RESET_DATA();
  143 + });
  144 +
  145 + },
  146 +
131 mounted() { 147 mounted() {
132 - this.BUYER_ASK_RESET_DATA(); 148 +
133 this.BUYER_ASK_SET_STORAGEID(this.storageId); 149 this.BUYER_ASK_SET_STORAGEID(this.storageId);
134 this.fetchBuyerOrderCount({ tabType: 'buy'}); 150 this.fetchBuyerOrderCount({ tabType: 'buy'});
135 this.fetchConfig(); 151 this.fetchConfig();
136 - this.$on("addressinfo", function (address) {  
137 - console.log(address)  
138 - }) 152 + this.$on('addressinfo', function(address) {
  153 + console.log(address);
  154 + });
139 }, 155 },
140 156
141 watch: { 157 watch: {
@@ -150,6 +166,14 @@ export default { @@ -150,6 +166,14 @@ export default {
150 if (val) { 166 if (val) {
151 this.showDialog(); 167 this.showDialog();
152 } 168 }
  169 + },
  170 +
  171 + addressInfo(val) {
  172 +
  173 + if (this.inputPrice && val) {
  174 + this.computePrice();
  175 + }
  176 +
153 } 177 }
154 }, 178 },
155 179
@@ -173,7 +197,7 @@ export default { @@ -173,7 +197,7 @@ export default {
173 if (this.originProductData.least_price && this.originProductData.skup && this.originProductData.least_price <= this.inputPrice) { 197 if (this.originProductData.least_price && this.originProductData.skup && this.originProductData.least_price <= this.inputPrice) {
174 this.showBuyDialog(); 198 this.showBuyDialog();
175 } else { 199 } else {
176 - this.buyerCompute({price: this.inputPrice, storage_id: this.storageId }); 200 + this.computePrice();
177 } 201 }
178 }, 500, {leading: false, trailing: true}), 202 }, 500, {leading: false, trailing: true}),
179 203
@@ -214,7 +238,7 @@ export default { @@ -214,7 +238,7 @@ export default {
214 }); 238 });
215 }, 239 },
216 onCancel: () => { 240 onCancel: () => {
217 - this.buyerCompute({price: this.inputPrice, storage_id: this.storageId }); 241 + this.computePrice();
218 } 242 }
219 }).show(); 243 }).show();
220 }, 244 },
@@ -241,7 +265,7 @@ export default { @@ -241,7 +265,7 @@ export default {
241 }, 265 },
242 266
243 onConfirm: () => { 267 onConfirm: () => {
244 - this.publishProduct() 268 + this.publishProduct();
245 }, 269 },
246 270
247 onCancel: () => { 271 onCancel: () => {
@@ -250,7 +274,7 @@ export default { @@ -250,7 +274,7 @@ export default {
250 274
251 }).show(); 275 }).show();
252 } else { 276 } else {
253 - this.publishProduct() 277 + this.publishProduct();
254 } 278 }
255 279
256 }, 280 },
@@ -265,8 +289,17 @@ export default { @@ -265,8 +289,17 @@ export default {
265 }); 289 });
266 }, 290 },
267 291
  292 + computePrice() {
  293 + if (!this.inputPrice) {
  294 + console.log('inputPrice is null')
  295 + return;
  296 + }
  297 + this.buyerCompute({price: this.inputPrice, storage_id: this.storageId, address_id: this.addressInfo.address_id || '' });
  298 + },
  299 +
268 payOrder() { 300 payOrder() {
269 let vm = this; 301 let vm = this;
  302 +
270 this.$createOrderPayType({ 303 this.$createOrderPayType({
271 price: get(this.publishresult, 'depositAmount', ''), 304 price: get(this.publishresult, 'depositAmount', ''),
272 desc: '保证金', 305 desc: '保证金',
@@ -372,11 +405,8 @@ export default { @@ -372,11 +405,8 @@ export default {
372 } 405 }
373 406
374 .pricedetail { 407 .pricedetail {
375 - display: flex;  
376 - flex-direction: row;  
377 height: 30*2px; 408 height: 30*2px;
378 margin-top: 5*2px; 409 margin-top: 5*2px;
379 - align-items: flex-end;  
380 } 410 }
381 411
382 .priceTitle { 412 .priceTitle {
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <div class="product-price"> 5 <div class="product-price">
6 <div class="product-price-wrapper"> 6 <div class="product-price-wrapper">
7 <div class="price">{{data.colorName}},{{data.sizeName}}</div> 7 <div class="price">{{data.colorName}},{{data.sizeName}}</div>
8 - <div class="tip">最低售价:<span class="price2">¥{{data.goodPrice}}</span></div> 8 + <div class="tip">{{ priceType || '最低售价:'}} <span class="price2">¥{{data.goodPrice}}</span></div>
9 </div> 9 </div>
10 </div> 10 </div>
11 </div> 11 </div>
@@ -20,6 +20,9 @@ export default { @@ -20,6 +20,9 @@ export default {
20 default() { 20 default() {
21 return {}; 21 return {};
22 } 22 }
  23 + },
  24 + priceType: {
  25 + type: String,
23 } 26 }
24 } 27 }
25 }; 28 };
@@ -55,6 +55,7 @@ @@ -55,6 +55,7 @@
55 v-for="(imgUrl, i) in miniFaultConfirm.imageUrls" 55 v-for="(imgUrl, i) in miniFaultConfirm.imageUrls"
56 :key="i" 56 :key="i"
57 > 57 >
  58 +
58 <ImageFormat 59 <ImageFormat
59 :data-secc="imgUrl" 60 :data-secc="imgUrl"
60 :src="imgUrl" 61 :src="imgUrl"
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <LayoutApp :show-back="true"> 3 <LayoutApp :show-back="true">
4 <div class="body"> 4 <div class="body">
5 <TitleComp txt="变现"></TitleComp> 5 <TitleComp txt="变现"></TitleComp>
6 - <ProductInfo :data="originProductData" class="product-info"></ProductInfo> 6 + <ProductInfo :data="originProductData" class="product-info" :priceType="'最高求购价'"></ProductInfo>
7 <div class="inputView"> 7 <div class="inputView">
8 <span class="inputViewIcon"> 8 <span class="inputViewIcon">
9 ¥ 9 ¥
@@ -74,6 +74,7 @@ export default { @@ -74,6 +74,7 @@ export default {
74 available: info.storage_num > 0 && price !== '-', 74 available: info.storage_num > 0 && price !== '-',
75 skup: info.skup, 75 skup: info.skup,
76 least_price: info.least_price, 76 least_price: info.least_price,
  77 + bid_moster_price: info.bid_moster_price,
77 }; 78 };
78 }); 79 });
79 }, 80 },
@@ -111,6 +112,7 @@ export default { @@ -111,6 +112,7 @@ export default {
111 * storageId: number 112 * storageId: number
112 */ 113 */
113 this.$store.commit('order/buyerAskOrder/BUYER_ASK_SET_PRODUCTINFO', { 114 this.$store.commit('order/buyerAskOrder/BUYER_ASK_SET_PRODUCTINFO', {
  115 + bid_moster_price: get(product, 'bid_moster_price', '-'),
114 least_price: get(product, 'least_price', '-'), 116 least_price: get(product, 'least_price', '-'),
115 sizeName: product.name, 117 sizeName: product.name,
116 sizeId: get(data, 'sizeId', ''), 118 sizeId: get(data, 'sizeId', ''),
@@ -186,8 +186,9 @@ export default { @@ -186,8 +186,9 @@ export default {
186 goodImg: get(this.product, 'goods_list[0].image_list[0].image_url', ''), 186 goodImg: get(this.product, 'goods_list[0].image_list[0].image_url', ''),
187 colorName: get(this.product, 'goods_list[0].color_name', ''), 187 colorName: get(this.product, 'goods_list[0].color_name', ''),
188 sizeName: this.sizeName, 188 sizeName: this.sizeName,
189 - goodPrice: get(this.productDetail, 'least_price', 0),  
190 - productId: this.product.product_id 189 + goodPrice: get(this.selectedSize, 'bid_moster_price', ''),
  190 + productId: this.product.product_id,
  191 + bid_moster_price: get(this.selectedSize, 'bid_moster_price', ''),
191 }); 192 });
192 // 跳转变现 193 // 跳转变现
193 this.$router.push({ 194 this.$router.push({
@@ -339,12 +339,13 @@ export default function() { @@ -339,12 +339,13 @@ export default function() {
339 }); 339 });
340 }, 340 },
341 341
342 - buyerCompute({commit}, {price = 0, storage_id = 0, uid} = {}) { 342 + buyerCompute({commit}, {price = 0, storage_id = 0, uid, address_id = ''} = {}) {
343 commit(BUYER_ASK_COMPUTE_REQUEST); 343 commit(BUYER_ASK_COMPUTE_REQUEST);
344 this.$api.get('/api/order/buyeraskcompute', { 344 this.$api.get('/api/order/buyeraskcompute', {
345 uid, 345 uid,
346 price, 346 price,
347 storage_id, 347 storage_id,
  348 + address_id,
348 }).then(result => { 349 }).then(result => {
349 350
350 if (result.code === 200) { 351 if (result.code === 200) {
@@ -5,6 +5,7 @@ const uuid = require('uuid'); @@ -5,6 +5,7 @@ const uuid = require('uuid');
5 const passport = require('passport'); 5 const passport = require('passport');
6 const TaobaoStrategy = require('./passport-taobao'); 6 const TaobaoStrategy = require('./passport-taobao');
7 const authcode = require('../../utils/authcode'); 7 const authcode = require('../../utils/authcode');
  8 +const redis = require('../../utils/redis');
8 const aes = require('./aes'); 9 const aes = require('./aes');
9 10
10 const log = global.yoho.logger; 11 const log = global.yoho.logger;
@@ -15,6 +16,7 @@ const loginPage = '//m.yohobuy.com/signin.html'; @@ -15,6 +16,7 @@ const loginPage = '//m.yohobuy.com/signin.html';
15 const homePage = `${config.siteUrl}/xianyu/channel`; 16 const homePage = `${config.siteUrl}/xianyu/channel`;
16 17
17 const URL_BIND_KEY = 'bind_code'; 18 const URL_BIND_KEY = 'bind_code';
  19 +const MAX_MSG_SEND_TIMES = 20;
18 20
19 // taobao 登录 21 // taobao 登录
20 passport.use('taobao', new TaobaoStrategy({ 22 passport.use('taobao', new TaobaoStrategy({
@@ -226,11 +228,26 @@ const bind = { @@ -226,11 +228,26 @@ const bind = {
226 228
227 return bindInfo; 229 return bindInfo;
228 }, 230 },
229 - sendSms(req, res, next) { 231 + async sendSms(req, res, next) {
230 let { mobile, bindCode } = req.body || {}; 232 let { mobile, bindCode } = req.body || {};
231 let info = bind.getBindThirdInfo(bindCode); 233 let info = bind.getBindThirdInfo(bindCode);
232 234
233 if (info.type === 'taobao') { 235 if (info.type === 'taobao') {
  236 + const timeKey = `${config.app}:bindsms:taobao:${info.openId}`;
  237 + let sendTimes = await redis.getAsync(timeKey);
  238 +
  239 + sendTimes = (sendTimes || 0) + 1;
  240 +
  241 + if (sendTimes > MAX_MSG_SEND_TIMES) {
  242 + log.info(`[SMS delivery times exceeded] type: taobao | openId: ${info.openId} | mobile: ${mobile} | ua: ${req.get('user-agent')}`);
  243 +
  244 + return res.json({
  245 + code: 403,
  246 + message: '操作频繁,请稍后重试'
  247 + });
  248 + }
  249 +
  250 + redis.setex(timeKey, 60 * 60 * 2, sendTimes);
234 req.ctx(passportModel).sendTaobaoBindCode(mobile, req.yoho.isAliApp ? 'xianyu' : '').then(res.json).catch(next); 251 req.ctx(passportModel).sendTaobaoBindCode(mobile, req.yoho.isAliApp ? 'xianyu' : '').then(res.json).catch(next);
235 } else { 252 } else {
236 res.json({ 253 res.json({