Authored by htoooth

fix hbs

@@ -212,11 +212,23 @@ exports.del = (uid, gender, channel, orderId) => { @@ -212,11 +212,23 @@ exports.del = (uid, gender, channel, orderId) => {
212 /** 212 /**
213 * 申请退款 213 * 申请退款
214 */ 214 */
215 -exports.refund = (orderId) => {  
216 - return api.get('', {  
217 - method: 'app.SpaceOrders.refundApply', 215 +exports.refund = (uid, orderId, reasonId, reason) => {
  216 + let params = {
  217 + uid: uid,
218 order_code: orderId 218 order_code: orderId
219 - }); 219 + };
  220 +
  221 + if (reasonId) {
  222 + params.reason_id = reasonId;
  223 + }
  224 +
  225 + if (reason) {
  226 + params.reason = reason;
  227 + }
  228 +
  229 + return api.get('', Object.assign({
  230 + method: 'app.SpaceOrders.refundApply'
  231 + }, params));
220 }; 232 };
221 233
222 /** 234 /**
@@ -105,6 +105,12 @@ const ORDER_OP_ALL = [ @@ -105,6 +105,12 @@ const ORDER_OP_ALL = [
105 hrefFun: it => helpers.urlFormat('/home/orders/detail', {orderCode: it}) 105 hrefFun: it => helpers.urlFormat('/home/orders/detail', {orderCode: it})
106 }, 106 },
107 { 107 {
  108 + type: 'refund',
  109 + name: '申请退款',
  110 + refund: true,
  111 + hrefFun: () => 'javascript:void(0)'
  112 + },
  113 + {
108 type: 'deposit', 114 type: 'deposit',
109 name: '定金预售商品只能在APP端操作', 115 name: '定金预售商品只能在APP端操作',
110 deposit: true, 116 deposit: true,
@@ -764,6 +770,14 @@ const closeReason = () => { @@ -764,6 +770,14 @@ const closeReason = () => {
764 }); 770 });
765 }; 771 };
766 772
  773 +const refundReason = () => {
  774 + return orderApi.refundReason().then((result) => {
  775 + return _.get(result, 'data', []);
  776 + });
  777 +};
  778 +
  779 +const refund = orderApi.refund;
  780 +
767 const detail = co(function * (uid, orderId) { 781 const detail = co(function * (uid, orderId) {
768 let apiData = yield Promise.props({ 782 let apiData = yield Promise.props({
769 detailData: _getOrderDetail(uid, orderId), 783 detailData: _getOrderDetail(uid, orderId),
@@ -794,5 +808,7 @@ module.exports = { @@ -794,5 +808,7 @@ module.exports = {
794 detail, 808 detail,
795 getOrders, 809 getOrders,
796 closeReason, 810 closeReason,
797 - express 811 + express,
  812 + refund,
  813 + refundReason
798 }; 814 };
  1 +<script id="cancel-dialog-tpl" type="text/html">
  2 + <header>取消订单</header>
  3 + <p class="tip">您取消订单的原因是:</p>
  4 + <ul class="cancel-reason clearfix">
  5 + {{# cancelReason}}
  6 + <li {{#if @last}}style="width:100%;"{{/if}}>
  7 + <input id="cancel-radio-{{id}}" type="radio" name="cancel-reason" value="{{id}}">
  8 + <label for="cancel-radio-{{id}}">{{reason}}</label>
  9 + {{#if @last}}<input type="text" id="reason_other" placeholder="50字以内" maxlength="50">{{/if}}
  10 + </li>
  11 + {{/ cancelReason}}
  12 + </ul>
  13 + <p class="tip reminder">温馨提示:</p>
  14 + <ul class="info-prompt">
  15 + <li><i>*</i>订单成功取消后无法恢复</li>
  16 + <li><i>*</i>该订单已付金额将原路返回</li>
  17 + <li><i>*</i>取消订单后,存在促销关系的子订单及优惠可能会一并取消</li>
  18 + </ul>
  19 + <p class="cancel-tip"></p>
  20 +</script>