Authored by 王洪广

修改退换货、订单列表

@@ -31,7 +31,7 @@ yoho币 | /home/mycurrency | @@ -31,7 +31,7 @@ yoho币 | /home/mycurrency |
31 关于我们 | /home/about | 31 关于我们 | /home/about |
32 物流详情 | /home/logistic?order_code=1609827614 | 32 物流详情 | /home/logistic?order_code=1609827614 |
33 退换货物流详情| /home/logistic?order_code=1609827614&type=refund| 33 退换货物流详情| /home/logistic?order_code=1609827614&type=refund|
34 - 34 +退换货列表 | /home/refund/orders |
35 -------------------------------------------------------------------------------- 35 --------------------------------------------------------------------------------
36 36
37 ---- 37 ----
@@ -16,7 +16,7 @@ const exchange = { @@ -16,7 +16,7 @@ const exchange = {
16 16
17 // 订单 可换货商品列表 17 // 订单 可换货商品列表
18 order(req, res, next) { 18 order(req, res, next) {
19 - const uid = req.user.uid || 8050882; 19 + const uid = 8041886;
20 const orderId = req.query.orderId; 20 const orderId = req.query.orderId;
21 21
22 if (!orderId) { 22 if (!orderId) {
@@ -48,6 +48,21 @@ const exchange = { @@ -48,6 +48,21 @@ const exchange = {
48 exchangeModel.submitExchange(uid, req.body).then(result => { 48 exchangeModel.submitExchange(uid, req.body).then(result => {
49 res.json(result); 49 res.json(result);
50 }).catch(next); 50 }).catch(next);
  51 + },
  52 +
  53 + /**
  54 + * 取消换货申请
  55 + * @param req
  56 + * @param res
  57 + * @param next
  58 + */
  59 + cancelApply(req, res, next) {
  60 + let id = req.body.id;
  61 + let uid = req.user.id;
  62 +
  63 + exchangeModel.cancelApply(uid, id).then(result => {
  64 + return res.json(result);
  65 + }).catch(next);
51 } 66 }
52 }; 67 };
53 68
@@ -90,6 +90,27 @@ const refund = { @@ -90,6 +90,27 @@ const refund = {
90 refundModel.getRefundOrders(param).then(result => { 90 refundModel.getRefundOrders(param).then(result => {
91 return res.json(result); 91 return res.json(result);
92 }); 92 });
  93 + },
  94 +
  95 + /**
  96 + * 取消申请
  97 + * @param req
  98 + * @param res
  99 + */
  100 + cancelApply(req, res) {
  101 + let uid = req.user.id;
  102 + let id = req.body.id;
  103 +
  104 + uid = testUid;
  105 + if (!uid && req.xhr) {
  106 + return res.json({
  107 + code: notLoginCode,
  108 + message: notLoginTip
  109 + });
  110 + }
  111 + refundModel.cancelRefundApply(uid, id).then(result => {
  112 + return res.json(result);
  113 + });
93 } 114 }
94 }; 115 };
95 116
@@ -36,6 +36,19 @@ const exchange = { @@ -36,6 +36,19 @@ const exchange = {
36 }, params); 36 }, params);
37 37
38 return api.post('', data).then(global.yoho.camelCase); 38 return api.post('', data).then(global.yoho.camelCase);
  39 + },
  40 +
  41 + /**
  42 + * 取消换货申请
  43 + * @param uid
  44 + * @param id
  45 + */
  46 + cancelApply(uid, id) {
  47 + return api.post('', {
  48 + uid: uid,
  49 + id: id,
  50 + method: 'app.change.cancel'
  51 + }).then(global.yoho.camelCase);
39 } 52 }
40 }; 53 };
41 54
@@ -50,7 +50,7 @@ exports.getOrderDetail = (uid, orderCode) => { @@ -50,7 +50,7 @@ exports.getOrderDetail = (uid, orderCode) => {
50 */ 50 */
51 exports.cancelOrder = (orderCode, reasonId, reason) => { 51 exports.cancelOrder = (orderCode, reasonId, reason) => {
52 52
53 - return api.get('057f5f856dff8b58.json', { 53 + return api.post('', {
54 method: 'app.SpaceOrders.close', 54 method: 'app.SpaceOrders.close',
55 order_code: orderCode, 55 order_code: orderCode,
56 reason_id: reasonId, 56 reason_id: reasonId,
@@ -67,7 +67,7 @@ exports.cancelOrder = (orderCode, reasonId, reason) => { @@ -67,7 +67,7 @@ exports.cancelOrder = (orderCode, reasonId, reason) => {
67 */ 67 */
68 exports.confirmOrder = (orderCode) => { 68 exports.confirmOrder = (orderCode) => {
69 69
70 - return api.get('', { 70 + return api.post('', {
71 method: 'app.SpaceOrders.confirm', 71 method: 'app.SpaceOrders.confirm',
72 order_code: orderCode 72 order_code: orderCode
73 }).then(result => { 73 }).then(result => {
@@ -82,7 +82,7 @@ exports.confirmOrder = (orderCode) => { @@ -82,7 +82,7 @@ exports.confirmOrder = (orderCode) => {
82 * @returns {Promise.<T>|*} 82 * @returns {Promise.<T>|*}
83 */ 83 */
84 exports.deleteOrder = (orderCode, uid) => { 84 exports.deleteOrder = (orderCode, uid) => {
85 - return api.get('', { 85 + return api.post('', {
86 method: 'app.SpaceOrders.delOrderByCode', 86 method: 'app.SpaceOrders.delOrderByCode',
87 order_code: orderCode, 87 order_code: orderCode,
88 uid: uid 88 uid: uid
@@ -52,6 +52,20 @@ const refund = { @@ -52,6 +52,20 @@ const refund = {
52 cache: true, 52 cache: true,
53 code: 200 53 code: 200
54 }).then(global.yoho.camelCase); 54 }).then(global.yoho.camelCase);
  55 + },
  56 +
  57 + /**
  58 + * 取消退货申请
  59 + *
  60 + * @param uid 用户id
  61 + * @param id 退货id
  62 + */
  63 + cancelRefundApply(uid, id) {
  64 + return api.post('', {
  65 + uid: uid,
  66 + id: id,
  67 + method: 'app.refund.cancel'
  68 + }).then(global.yoho.camelCase);
55 } 69 }
56 }; 70 };
57 71
@@ -46,6 +46,7 @@ router.get('/refund/order', refund.order); // 查询订单数据 @@ -46,6 +46,7 @@ router.get('/refund/order', refund.order); // 查询订单数据
46 router.post('/refund/submit', refund.submit); // 提交信息 46 router.post('/refund/submit', refund.submit); // 提交信息
47 router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回信息 47 router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回信息
48 router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息 48 router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息
  49 +router.post('/refund/cancel-apply', refund.cancelApply); // 退货 - 取消申请
49 50
50 router.get('/exchange-status', refund.exchangeGoods); // 退换货 - 换货状态 51 router.get('/exchange-status', refund.exchangeGoods); // 退换货 - 换货状态
51 router.get('/refund/orders', refund.refundOrders); // 退换货 - 订单列表 52 router.get('/refund/orders', refund.refundOrders); // 退换货 - 订单列表
@@ -56,6 +57,7 @@ router.get('/exchange', exchange.exchange); @@ -56,6 +57,7 @@ router.get('/exchange', exchange.exchange);
56 router.get('/exchange/order', exchange.order); // AJAX 获取订单 商品 57 router.get('/exchange/order', exchange.order); // AJAX 获取订单 商品
57 router.get('/exchange/delivery', exchange.delivery); // AJAX 获取 退货方式 58 router.get('/exchange/delivery', exchange.delivery); // AJAX 获取 退货方式
58 router.post('/exchange/submit', exchange.submit); // AJAX 提交换货 申请 59 router.post('/exchange/submit', exchange.submit); // AJAX 提交换货 申请
  60 +router.post('/exchange/cancel-apply', exchange.cancelApply); // AJAX 取消换货申请
59 61
60 router.get('/mydetails', home.mydetails); // 个人信息 62 router.get('/mydetails', home.mydetails); // 个人信息
61 router.post('/save-mydetails', home.saveMydetails); // 保存个人信息 63 router.post('/save-mydetails', home.saveMydetails); // 保存个人信息
1 <div class="select"> 1 <div class="select">
2 <ul> 2 <ul>
3 {{#each items}} 3 {{#each items}}
4 - <li class="item-li {{#if disabled}} disabled {{/if}}" key="{{key}}" status="{{disabled}}">{{val}}</li> 4 + <li class="item-li {{#if disabled}} disabled {{/if}}" key="{{key}}" status="{{disabled}}">{{{val}}}</li>
5 {{/each}} 5 {{/each}}
6 <li class="item-del"> 6 <li class="item-del">
7 <span>取消</span> 7 <span>取消</span>
@@ -43,14 +43,14 @@ function Select(items) { @@ -43,14 +43,14 @@ function Select(items) {
43 if (elem.parent().length === 0) { 43 if (elem.parent().length === 0) {
44 const lis = elem.find('.item-li'); 44 const lis = elem.find('.item-li');
45 45
46 - lis.each(function() {  
47 - if (!$(this).attr('status')) { 46 + lis.each(function(index) {
  47 + if ($(this).attr('status') === 'false' || $(this).attr('status') === '') {
48 $(this).click(function(e) { 48 $(this).click(function(e) {
49 hide(); 49 hide();
50 - cb({  
51 - key: $(e.target).attr('key'),  
52 - val: e.target.innerHTML  
53 - }); 50 + cb(Object.assign({
  51 + key: e.target.getAttribute('key'),
  52 + val: e.target.innerText
  53 + }, items[index]));
54 }); 54 });
55 } 55 }
56 }); 56 });
@@ -212,6 +212,7 @@ body { @@ -212,6 +212,7 @@ body {
212 border: 0 none; 212 border: 0 none;
213 background: $white; 213 background: $white;
214 font-size: 28px; 214 font-size: 28px;
  215 + margin-right: 10px;
215 216
216 &.black { 217 &.black {
217 width: 192px; 218 width: 192px;
@@ -237,3 +238,7 @@ body { @@ -237,3 +238,7 @@ body {
237 } 238 }
238 } 239 }
239 } 240 }
  241 +
  242 +.select .overdue{
  243 + color: #b0b0b0;
  244 +}
@@ -199,3 +199,40 @@ $white: #fff; @@ -199,3 +199,40 @@ $white: #fff;
199 } 199 }
200 } 200 }
201 } 201 }
  202 +
  203 +.order-empty {
  204 + width: 100%;
  205 + height: 100%;
  206 + text-align: center;
  207 + background: $white;
  208 +
  209 + &:before {
  210 + content: "";
  211 + display: inline-block;
  212 + width: 153px;
  213 + height: 195px;
  214 + margin-top: 290px;
  215 + background: resolve("home/noorder.png") no-repeat;
  216 + background-size: 100%;
  217 + }
  218 +
  219 + p{
  220 + color: #b0b0b0;
  221 + }
  222 +
  223 + p:first-of-type{
  224 + font-size: 34px;
  225 + margin: 50px 0 20px;
  226 + }
  227 +
  228 + a{
  229 + display: inline-block;
  230 + width: 414px;
  231 + height: 94px;
  232 + margin-top: 60px;
  233 + background: $black;
  234 + color: $white;
  235 + line-height: 94px;
  236 + font-size: 28px;
  237 + }
  238 +}
@@ -43,10 +43,11 @@ @@ -43,10 +43,11 @@
43 <div class="order-button" v-show="order.status != 1 && order.status != 2 && order.status != 3"> 43 <div class="order-button" v-show="order.status != 1 && order.status != 2 && order.status != 3">
44 <button v-if="order.status == 0" @click="cancelOrder(order.orderCode)">取消订单</button> 44 <button v-if="order.status == 0" @click="cancelOrder(order.orderCode)">取消订单</button>
45 <button v-if="order.status == 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button> 45 <button v-if="order.status == 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button>
46 - <button v-if="order.status == 4 || order.status == 5 ">查看物流</button> 46 + <button v-if="order.status == 4 || order.status == 5 " @click="seeExpress(order.orderCode)">查看物流</button>
47 <button v-if="order.status == 4 || order.status == 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button> 47 <button v-if="order.status == 4 || order.status == 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button>
48 <button v-if="order.status == 6" @click="deleteOrder(order,index)">删除订单</button> 48 <button v-if="order.status == 6" @click="deleteOrder(order,index)">删除订单</button>
49 <button v-if="order.status == 6" class="normal">再次购买</button> 49 <button v-if="order.status == 6" class="normal">再次购买</button>
  50 + <button v-if="order.isSupportRefund == 'Y' || order.isSupportExchange == 'Y'" class="normal" @click="applyRefund()">申请售后</button>
50 </div> 51 </div>
51 </template> 52 </template>
52 <script> 53 <script>
@@ -56,6 +57,7 @@ @@ -56,6 +57,7 @@
56 const tip = require('common/tip'); 57 const tip = require('common/tip');
57 const Modal = require('common/modal'); 58 const Modal = require('common/modal');
58 const yohoAPI = require('yoho'); 59 const yohoAPI = require('yoho');
  60 + let genderSel = require('common/select');
59 61
60 module.exports = { 62 module.exports = {
61 data() { 63 data() {
@@ -76,6 +78,24 @@ @@ -76,6 +78,24 @@
76 }).then(result => { 78 }).then(result => {
77 if (result.code === 200) { 79 if (result.code === 200) {
78 this.$set('order', result.data); 80 this.$set('order', result.data);
  81 + genderSel = genderSel([
  82 + {
  83 + key: this.order.isSupportRefund = 'N',
  84 + val: this.order.isSupportRefund === 'Y' ? '申请退货' : '<span class="overdue">申请退货(已过期限)</span>',
  85 + url: '/home/refund?orderId=' + this.order.orderCode,
  86 + disabled: this.order.isSupportRefund !== 'Y'
  87 + },
  88 + {
  89 + key: this.order.isSupportExchange,
  90 + val: this.order.isSupportExchange === 'Y' ? '申请换货' : '<span class="overdue">申请换货(已过期限)</span>',
  91 + url: '/home/exchange?orderId=' + this.order.orderCode,
  92 + disabled: this.order.isSupportExchange !== 'Y'
  93 + },
  94 + {
  95 + key: 'onlineService',
  96 + val: '在线客服'
  97 + }
  98 + ]);
79 } else { 99 } else {
80 tip(result.message); 100 tip(result.message);
81 } 101 }
@@ -161,8 +181,18 @@ @@ -161,8 +181,18 @@
161 goBuy(code) { 181 goBuy(code) {
162 yohoAPI.goPay({orderid: code}); 182 yohoAPI.goPay({orderid: code});
163 }, 183 },
164 - seeExpress() {  
165 - location.href = ''; 184 + seeExpress(code) {
  185 + location.href = '/home/logistic?order_code='+code;
  186 + },
  187 +
  188 + /**
  189 + * 申请售后
  190 + */
  191 + applyRefund(code) {
  192 + genderSel.show(function(item) {
  193 + console.log(item)
  194 + location.href = item.url;
  195 + });
166 } 196 }
167 } 197 }
168 }; 198 };
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 <div class="options"> 30 <div class="options">
31 <button v-if="order.status === 0" @click="cancelOrder(order.orderCode)">取消订单</button> 31 <button v-if="order.status === 0" @click="cancelOrder(order.orderCode)">取消订单</button>
32 <button v-if="order.status === 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button> 32 <button v-if="order.status === 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button>
33 - <button v-if="order.status === 4 || order.status === 5 ">查看物流</button> 33 + <button v-if="order.status === 4 || order.status === 5 " @click="seeExpress(order.orderCode)">查看物流</button>
34 <button v-if="order.status === 4 || order.status === 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button> 34 <button v-if="order.status === 4 || order.status === 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button>
35 <button v-if="order.status === 6" @click="deleteOrder(order,index)">删除订单</button> 35 <button v-if="order.status === 6" @click="deleteOrder(order,index)">删除订单</button>
36 <button v-if="order.status === 6" class="normal">再次购买</button> 36 <button v-if="order.status === 6" class="normal">再次购买</button>
@@ -39,6 +39,11 @@ @@ -39,6 +39,11 @@
39 </div> 39 </div>
40 </li> 40 </li>
41 </ul> 41 </ul>
  42 + <div class="order-empty {{emptybox}}">
  43 + <p>您暂时还没有订单</p>
  44 + <p>Your do not have an order <br>for the time being</p>
  45 + <a href="">去购物</a>
  46 + </div>
42 </template> 47 </template>
43 48
44 <script> 49 <script>
@@ -58,6 +63,7 @@ @@ -58,6 +63,7 @@
58 type: this.$parent.$data.type, 63 type: this.$parent.$data.type,
59 orderList: [], 64 orderList: [],
60 busy: false, 65 busy: false,
  66 + emptybox: 'hide'
61 }; 67 };
62 }, 68 },
63 69
@@ -86,7 +92,11 @@ @@ -86,7 +92,11 @@
86 if (result.data.orderList.length > 0) { 92 if (result.data.orderList.length > 0) {
87 this.$set('orderList', _that.orderList.concat(result.data.orderList)); 93 this.$set('orderList', _that.orderList.concat(result.data.orderList));
88 _that.pageTotal = result.data.pageTotal; 94 _that.pageTotal = result.data.pageTotal;
  95 + } else {
  96 + _that.emptybox = '';
89 } 97 }
  98 + } else {
  99 + _that.emptybox = '';
90 } 100 }
91 }).fail(() => { 101 }).fail(() => {
92 tip('网络错误'); 102 tip('网络错误');
@@ -172,8 +182,8 @@ @@ -172,8 +182,8 @@
172 goBuy(code) { 182 goBuy(code) {
173 yohoAPI.goPay({orderid: code}); 183 yohoAPI.goPay({orderid: code});
174 }, 184 },
175 - seeExpress() {  
176 - location.href = ''; 185 + seeExpress(code) {
  186 + location.href = '/home/logistic?order_code='+code;
177 } 187 }
178 } 188 }
179 }; 189 };
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 <div class="order-option" v-show="order.canCancel == 'Y'"> 31 <div class="order-option" v-show="order.canCancel == 'Y'">
32 <div class="goods-total"></div> 32 <div class="goods-total"></div>
33 <div class="options" v-show="order.canCancel == 'Y'"> 33 <div class="options" v-show="order.canCancel == 'Y'">
34 - <button v-if="order.canCancel == 'Y'" class="normal">取消申请</button> 34 + <button v-if="order.canCancel == 'Y'" class="normal" @click="cancelApply(order.id, order.refundType)">取消申请</button>
35 </div> 35 </div>
36 </div> 36 </div>
37 </div> 37 </div>
@@ -85,12 +85,17 @@ @@ -85,12 +85,17 @@
85 tip('网络错误'); 85 tip('网络错误');
86 }); 86 });
87 }, 87 },
88 - cancelApply(code) { 88 + /**
  89 + * 取消申请
  90 + * @param id
  91 + * @param type refundType 1为退货,2为换货
  92 + */
  93 + cancelApply(id, type) {
89 $.ajax({ 94 $.ajax({
90 - url: '/home/cancel-apply', 95 + url: '/home/'+(type == 2 ? 'exchange' : 'refund')+'/cancel-apply',
91 type: 'post', 96 type: 'post',
92 data: { 97 data: {
93 - orderCode: code 98 + id: id
94 } 99 }
95 }).then(result => { 100 }).then(result => {
96 if (result.code === 200) { 101 if (result.code === 200) {