123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- // +----------------------------------------------------------------------
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- // +----------------------------------------------------------------------
- // | Author: CRMEB Team <admin@crmeb.com>
- // +----------------------------------------------------------------------
- import {
- preOrderApi,refundOrderRevokeApi
- } from '@/api/order.js';
- import {
- preSecondHandOrderApi,
- refundSecondHandRevokeApi
- } from '@/api/secondHand.js';
- import util from '@/utils/util'
- import animationType from '@/utils/animationType.js'
- import { ProductMarketingTypeEnum, ProductTypeEnum } from "@/enums/productEnums";
- /**
- * 去订单详情
- */
- export function goOrderDetail(orderNo) {
- return new Promise(resolve => {
- if (!orderNo) return that.$util.Tips({
- title: '缺少订单号无法查看订单详情'
- });
- // #ifdef MP
- uni.navigateTo({
- url: '/pages/goods/order_details/index?orderNo=' + orderNo
- })
- // #endif
- // #ifndef MP
- uni.navigateTo({
- animationType: animationType.type,
- animationDuration: animationType.duration,
- url: '/pages/goods/order_details/index?orderNo=' + orderNo
- })
- // #endif
- });
- }
- /**
- * 去商品详情
- */
- export function goProductDetail(id, marketingType, params, data, isManage) {
- return new Promise(resolve => {
- // #ifdef MP
- uni.navigateTo({
- url: `/pages/goods/goods_details/index?id=${id}&mt=${marketingType}${params}&dataItem=${data||''}&isManage=${isManage}`
- })
- // #endif
- // #ifndef MP
- uni.navigateTo({
- animationType: animationType.type,
- animationDuration: animationType.duration,
- url: `/pages/goods/goods_details/index?id=${id}&mt=${marketingType}${params}&dataItem=${data||''}&isManage=${isManage}`
- })
- // #endif
- });
- }
- /**
- * 活动商品、普通商品、购物车、再次购买预下单
- */
- export function onGetPreOrder(preOrderType, orderDetails) {
- return new Promise((resolve, reject) => {
- preOrderApi({
- "preOrderType": preOrderType,
- "orderDetails": orderDetails
- }).then(res => {
- uni.navigateTo({
- url: '/pages/goods/order_confirm/index?orderNo=' + res.data.orderNo
- });
- }).catch(err => {
- return util.Tips({
- title: err
- });
- })
- });
- }
- /**
- * 二手交易预下单
- */
- export function onGetPreSecondHandOrder(orderDetails) {
- return new Promise((resolve, reject) => {
- preSecondHandOrderApi({
- "orderDetails": orderDetails
- }).then(res => {
- uni.navigateTo({
- url: '/pages/goods/order_confirm/index?orderNo=' + res.data.orderNo + '&orderType=secondHand'
- });
- }).catch(err => {
- return util.Tips({
- title: err
- });
- })
- });
- }
- /**
- * 售后,撤销售后申请
- */
- export function onRevokeRefund(refundOrderNo, type) {
- return new Promise((resolve, reject) => {
- uni.showModal({
- title: '提示',
- content: '确定要撤销本次退款申请吗?',
- success: function(res) {
- if (res.confirm) {
- let api = type ? refundSecondHandRevokeApi : refundOrderRevokeApi;
- api(refundOrderNo).then(res => {
- resolve()
- }).catch(err => {
- return util.Tips({
- title: err
- });
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- });
- }
- /**
- * 去协议详情
- */
- export function goToAgreement(from) {
- return new Promise(resolve => {
- // #ifdef MP
- uni.navigateTo({
- url: `/pages/goods/agreement_info/index?from=${from}`
- })
- // #endif
- // #ifndef MP
- uni.navigateTo({
- animationType: animationType.type,
- animationDuration: animationType.duration,
- url: `/pages/goods/agreement_info/index?from=${from}`
- })
- // #endif
- });
- }
- // 普通商品、虚拟(开启可申请退款开关)、视频号可申请退款
- export function isRefund(orderInfo) {
- return (
- orderInfo.type === ProductMarketingTypeEnum.Normal &&
- (orderInfo.secondType === ProductTypeEnum.Normal ||
- orderInfo.secondType === ProductTypeEnum.Fictitious ||
- orderInfo.secondType === ProductTypeEnum.Video)
- )
- }
|