Authored by TaoHuang

feat(second): add report

@@ -211,6 +211,20 @@ export default { @@ -211,6 +211,20 @@ export default {
211 type: 4 211 type: 4
212 }; 212 };
213 } 213 }
  214 + case 'second': {
  215 + return {
  216 + pay: 'XY_UFO_SALE_PAY',
  217 + result: 'XY_UFO_SALE_PAY_RES',
  218 + type: 5
  219 + };
  220 + }
  221 + case 'newSecond': {
  222 + return {
  223 + pay: 'XY_UFO_SALE_PAY',
  224 + result: 'XY_UFO_SALE_PAY_RES',
  225 + type: 6
  226 + };
  227 + }
214 default: { 228 default: {
215 // PASS 229 // PASS
216 return { 230 return {
@@ -80,7 +80,8 @@ export default { @@ -80,7 +80,8 @@ export default {
80 colorName: get(state.second.info, 'colorName', ''), 80 colorName: get(state.second.info, 'colorName', ''),
81 sizeName: get(state.second.info, 'sizeName', ''), 81 sizeName: get(state.second.info, 'sizeName', ''),
82 goodPrice: get(state.second.info, 'price', ''), 82 goodPrice: get(state.second.info, 'price', ''),
83 - skup: this.skup 83 + skup: this.skup,
  84 + type: get(state.second.info, 'sechondHandTypeName', '') === '二手' ? 5 : 6,
84 }; 85 };
85 } else { 86 } else {
86 return { 87 return {
@@ -235,7 +236,7 @@ export default { @@ -235,7 +236,7 @@ export default {
235 desc: '金额', 236 desc: '金额',
236 extra: JSON.stringify({ 237 extra: JSON.stringify({
237 type: UserType.buy, 238 type: UserType.buy,
238 - reportType: 'buy', 239 + reportType: this.getType(this.productDetail.type),
239 back: { 240 back: {
240 name: 'buyOrderDetail', 241 name: 'buyOrderDetail',
241 params: { 242 params: {
@@ -257,6 +258,15 @@ export default { @@ -257,6 +258,15 @@ export default {
257 }).show(); 258 }).show();
258 259
259 //数据埋点 260 //数据埋点
  261 + if (this.productDetail.type) {
  262 + // 二手
  263 + this.reportYas('XY_UFO_RESALE_ORD', {
  264 + ORD_NUM: result.data.orderCode,
  265 + PRD_ID: this.productId,
  266 + PRD_SKU: this.productDetail.skup,
  267 + ORD_TYPE: this.productDetail.type
  268 + });
  269 + } else {
260 this.reportYas('XY_UFO_SC_ORD', { 270 this.reportYas('XY_UFO_SC_ORD', {
261 ORD_NUM: result.data.orderCode, 271 ORD_NUM: result.data.orderCode,
262 PRD_ID: this.productId, 272 PRD_ID: this.productId,
@@ -265,6 +275,7 @@ export default { @@ -265,6 +275,7 @@ export default {
265 ORD_AMOUNT: this.orderDetail.amount, 275 ORD_AMOUNT: this.orderDetail.amount,
266 PRD_PRICE: this.productDetail.goodPrice, 276 PRD_PRICE: this.productDetail.goodPrice,
267 }); 277 });
  278 + }
268 }, 279 },
269 onClose(orderCode) { 280 onClose(orderCode) {
270 this.$router.replace({ 281 this.$router.replace({
@@ -329,6 +340,16 @@ export default { @@ -329,6 +340,16 @@ export default {
329 param: params 340 param: params
330 } 341 }
331 }); 342 });
  343 + },
  344 + getType(type) {
  345 + switch (type) {
  346 + case 5:
  347 + return 'second';
  348 + case 6:
  349 + return 'newSecond';
  350 + default:
  351 + return 'buy';
  352 + }
332 } 353 }
333 } 354 }
334 }; 355 };
@@ -307,6 +307,18 @@ export default { @@ -307,6 +307,18 @@ export default {
307 307
308 const { data: count } = await this.fetchStorageCount({ storageId }); 308 const { data: count } = await this.fetchStorageCount({ storageId });
309 309
  310 + this.$store.dispatch('reportYas', {
  311 + params: {
  312 + appop: 'XY_UFO_PRD_DT_BUY_SEL_C',
  313 + param: {
  314 + PRD_ID: this.product.product_id,
  315 + PRD_SKU: get(this.selectedSize, 'second_hand_skup', 0),
  316 + PRD_SIZE: get(this.selectedSize, 'size_id', 0),
  317 + ORD_TYPE: 5,
  318 + },
  319 + },
  320 + });
  321 +
310 if (count === 1) { 322 if (count === 1) {
311 // 跳转详情 323 // 跳转详情
312 this.$router.push({ 324 this.$router.push({
@@ -141,6 +141,18 @@ export default { @@ -141,6 +141,18 @@ export default {
141 skup: this.skup 141 skup: this.skup
142 } 142 }
143 }); 143 });
  144 +
  145 + this.$store.dispatch('reportYas', {
  146 + params: {
  147 + appop: 'XY_UFO_SECOND_PRD_DT_BUY_C',
  148 + param: {
  149 + PRD_ID: this.info.productId,
  150 + PRD_SKU: this.skup,
  151 + PRD_SIZE: this.info.size_name,
  152 + ORD_TYPE: this.info.sechondHandTypeName === '二手' ? 5 : 6,
  153 + },
  154 + },
  155 + });
144 } 156 }
145 }, 157 },
146 computed: { 158 computed: {
@@ -70,6 +70,7 @@ module.exports = (req, res, next) => { @@ -70,6 +70,7 @@ module.exports = (req, res, next) => {
70 70
71 axios.post('https://analytics.m.yohobuy.com/yas_mobile', data, { 71 axios.post('https://analytics.m.yohobuy.com/yas_mobile', data, {
72 headers: { 72 headers: {
  73 + referer: 'https://xianyu.yohobuy.com/',
73 'content-type': 'application/x-www-form-urlencoded' 74 'content-type': 'application/x-www-form-urlencoded'
74 } 75 }
75 }); 76 });