Authored by ccbikai

退货商品列表

  1 +/**
  2 + * 退换货
  3 + * @type {Object}
  4 + */
  5 +const refundModel = require('../models/refund');
  6 +
  7 +const refund = {
  8 + refund(req, res) {
  9 + res.render('refund');
  10 + },
  11 + order(req, res, next) {
  12 + const uid = 8050560;
  13 + const orderId = 160192757;
  14 +
  15 + refundModel.getOrderData(uid, orderId).then(result => {
  16 + res.json(result);
  17 + }).catch(next);
  18 + }
  19 +};
  20 +
  21 +module.exports = refund;
  1 +/**
  2 + * 退换货 Model
  3 + * @type {Object}
  4 + */
  5 +const api = global.yoho.API;
  6 +
  7 +const refund = {
  8 + getOrderData(uid, orderId) {
  9 + return api.get('', {
  10 + method: 'app.refund.goodsList',
  11 + uid: uid,
  12 + order_code: orderId
  13 + }, {
  14 + cache: true,
  15 + code: 200
  16 + }).then(global.yoho.camelCase);
  17 + }
  18 +};
  19 +
  20 +module.exports = refund;
@@ -6,9 +6,12 @@ @@ -6,9 +6,12 @@
6 6
7 'use strict'; 7 'use strict';
8 8
9 -const router = require('express').Router(); 9 +const expressRouter = require('express').Router;
10 const cRoot = './controllers'; 10 const cRoot = './controllers';
11 const home = require(cRoot); 11 const home = require(cRoot);
  12 +const refund = require(cRoot + '/refund');
  13 +
  14 +const router = expressRouter();
12 15
13 // Your controller here 16 // Your controller here
14 router.get('/', home.index); // 个人中心主页 17 router.get('/', home.index); // 个人中心主页
@@ -21,4 +24,7 @@ router.get('/favorite', home.favorite); // 个人中心 - 收藏 @@ -21,4 +24,7 @@ router.get('/favorite', home.favorite); // 个人中心 - 收藏
21 router.get('/favorite/favpaging', home.favpaging); // 个人中心 - 收藏商品/品牌(翻页) 24 router.get('/favorite/favpaging', home.favpaging); // 个人中心 - 收藏商品/品牌(翻页)
22 router.post('/favorite/favdel', home.favdel); // 个人中心 - 收藏商品/品牌(刪除) 25 router.post('/favorite/favdel', home.favdel); // 个人中心 - 收藏商品/品牌(刪除)
23 26
24 -module.exports = router;  
  27 +router.get('/refund', refund.refund);
  28 +router.get('/refund/order', refund.order);
  29 +
  30 +module.exports = router;
  1 +<div id="refund">
  2 + <refund></refund>
  3 +</div>
  1 +const Vue = require('yoho-vue');
  2 +const lazyload = require('yoho-vue-lazyload');
  3 +
  4 +const refund = require('home/refund.vue');
  5 +
  6 +require('common/vue-filter');
  7 +
  8 +Vue.use(lazyload);
  9 +
  10 +new Vue({
  11 + el: '#refund',
  12 + components: {
  13 + refund
  14 + }
  15 +});
@@ -7,6 +7,8 @@ @@ -7,6 +7,8 @@
7 *, 7 *,
8 *:before, 8 *:before,
9 *:after { 9 *:after {
  10 + margin: 0;
  11 + padding: 0;
10 box-sizing: border-box; 12 box-sizing: border-box;
11 -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 13 -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
12 } 14 }
@@ -14,6 +16,7 @@ @@ -14,6 +16,7 @@
14 html, 16 html,
15 body { 17 body {
16 width: 100%; 18 width: 100%;
  19 + height: 100%;
17 font-size: 24px; 20 font-size: 24px;
18 font-family: Helvetica, Roboto, "Heiti SC", "黑体", Arial; 21 font-family: Helvetica, Roboto, "Heiti SC", "黑体", Arial;
19 line-height: 1.4; 22 line-height: 1.4;
@@ -33,8 +36,9 @@ a { @@ -33,8 +36,9 @@ a {
33 position: relative; 36 position: relative;
34 margin-right: auto; 37 margin-right: auto;
35 margin-left: auto; 38 margin-left: auto;
36 - max-width: 750px;  
37 width: 100%; 39 width: 100%;
  40 + max-width: 750px;
  41 + min-height: 100%;
38 } 42 }
39 43
40 .text-center { 44 .text-center {
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 8
9 &:before { 9 &:before {
10 z-index: 8; 10 z-index: 8;
11 - border: 2px solid $black; 11 + border: 2PX solid $black;
12 content: ""; 12 content: "";
13 } 13 }
14 14
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 display: none; 20 display: none;
21 width: 8px; 21 width: 8px;
22 height: 16px; 22 height: 16px;
23 - border: 2px solid $white; 23 + border: 2PX solid $white;
24 border-top: 0; 24 border-top: 0;
25 border-left: 0; 25 border-left: 0;
26 content: ""; 26 content: "";
  1 +<template>
  2 + <div class="refund">
  3 + <product-list :title="title" :list="list"></product-list>
  4 + </div>
  5 +</template>
  6 +
  7 +<script>
  8 + const $ = require('yoho-jquery');
  9 + const productList = require('home/refund/product-list.vue');
  10 +
  11 + module.exports = {
  12 + data() {
  13 + return {
  14 + title: '请选择退货商品',
  15 + list: []
  16 + };
  17 + },
  18 + created() {
  19 + $.ajax({
  20 + url: '/home/refund/order'
  21 + }).then(res => {
  22 + if (res.data && res.data.goodsList) {
  23 + res.data.goodsList.forEach(product => {
  24 + product.checked = false;
  25 + });
  26 + this.list = res.data.goodsList;
  27 + }
  28 + });
  29 + },
  30 + methods: {},
  31 + components: {
  32 + productList
  33 + }
  34 + };
  35 +</script>
  36 +
  37 +<style>
  38 + .main-wrap {
  39 + background: #f6f6f6;
  40 + }
  41 +</style>
  1 +<template>
  2 + <div class="title">
  3 + {{title}}
  4 + </div>
  5 + <div v-show="checkedList.length" class="product-list product-list-checked">
  6 + <pruduct v-for="product in list" v-if="product.checked" v-bind:product="product"></pruduct>
  7 + </div>
  8 + <div v-show="checkedList.length !== list.length" class="product-list">
  9 + <pruduct v-for="product in list" v-if="!product.checked" v-bind:product="product"></pruduct>
  10 + </div>
  11 +</template>
  12 +
  13 +<script>
  14 + const pruduct = require('./product.vue');
  15 +
  16 + module.exports = {
  17 + props: ['title', 'list'],
  18 + computed: {
  19 + checkedList() {
  20 + return this.list.filter(product => {
  21 + return product.checked;
  22 + });
  23 + }
  24 + },
  25 + components: {
  26 + pruduct
  27 + }
  28 + };
  29 +</script>
  30 +
  31 +<style>
  32 + .title {
  33 + padding: 30px 30px 0;
  34 + color: #b0b0b0;
  35 + font-size: 28px;
  36 + line-height: 60px;
  37 + }
  38 +
  39 + .product-list {
  40 + margin-bottom: 30px;
  41 + background: #fff;
  42 + border-top: 1px solid #eee;
  43 + border-bottom: 1px solid #eee;
  44 + }
  45 +</style>
  1 +<template>
  2 + <div class="product clearfix">
  3 + <div class="checkbox">
  4 + <input type="checkbox" checked="{{product.checked}}" v-on:change="checkboxChange" id="checkbox-{{product.goodsId}}">
  5 + <label for="checkbox-{{product.goodsId}}"></label>
  6 + </div>
  7 + <img class="image" v-lazy="product.goodsImage | resize 100 130">
  8 + <div class="info">
  9 + <div class="p-title">
  10 + {{product.productName}}{{product.productName}}{{product.productName}}{{product.productName}}
  11 + </div>
  12 + <div class="meta">
  13 + <span class="color">颜色: {{product.colorName}}</span>
  14 + <span class="size">尺码: {{product.sizeName}}</span>
  15 + </div>
  16 + </div>
  17 + <div class="price">
  18 + &yen;{{product.lastPrice}}
  19 + <p class="num">
  20 + x1
  21 + </p>
  22 + </div>
  23 + </div>
  24 +</template>
  25 +
  26 +<script>
  27 + module.exports = {
  28 + props: ['product'],
  29 + methods: {
  30 + checkboxChange(e) {
  31 + this.product.checked = e.target.checked;
  32 + }
  33 + }
  34 + };
  35 +</script>
  36 +
  37 +<style>
  38 + .product {
  39 + position: relative;
  40 + padding: 0 30px;
  41 + height: 170px;
  42 + font-size: 24px;
  43 + line-height: 1.5;
  44 +
  45 + &:after {
  46 + content: "";
  47 + position: absolute;
  48 + left: 30px;
  49 + bottom: -1px;
  50 + width: 690px;
  51 + height: 0;
  52 + border-bottom: 1px solid #eee;
  53 + }
  54 +
  55 + .checkbox {
  56 + float: left;
  57 + margin-top: 67px;
  58 +
  59 + label:before {
  60 + border-radius: 100%;
  61 + }
  62 + }
  63 +
  64 + .image {
  65 + float: left;
  66 + margin: 20px;
  67 + width: 100px;
  68 + height: 130px;
  69 + }
  70 +
  71 + .info {
  72 + padding: 15px 0;
  73 + width: 520px;
  74 +
  75 + .p-title {
  76 + color: #000;
  77 + font-size: 24px;
  78 + height: 72px;
  79 + overflow: hidden;
  80 + }
  81 +
  82 + .meta {
  83 + margin-top: 10px;
  84 + color: #b0b0b0;
  85 + }
  86 +
  87 + .color {
  88 + margin-right: 30px;
  89 + }
  90 + }
  91 +
  92 + .price {
  93 + position: absolute;
  94 + top: 15px;
  95 + right: 30px;
  96 + text-align: right;
  97 +
  98 + .num {
  99 + color: #b0b0b0;
  100 + }
  101 + }
  102 + }
  103 +</style>