mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
1.添加PC端订单支付 弹出支付二维码 2.添加确认订单的面包屑 从购物车和其他方向进去的不同显示 3.修改移动端按钮和合计样式显示问题 4.添加购物车的全选功能 5.添加支付页面面包屑功能 6.修改订单详情页 添加面包屑和分割线 7.添加购物车数量编辑的保存
693 lines
14 KiB
JavaScript
693 lines
14 KiB
JavaScript
import fetch from '../config/async/fetch'
|
|
/**
|
|
* 点击对应课程请求三级分类
|
|
* @param {*一级课程id} classId
|
|
*/
|
|
export const syncClass = classId => fetch('/api/listhome/' + classId)
|
|
|
|
/**
|
|
* 筛选条件下拉的展示请求
|
|
*/
|
|
export const filter = () => fetch('/api/listhome/filter/data')
|
|
|
|
/**
|
|
* 获取课程列表
|
|
*/
|
|
export const courselist = (offset, courseId, type, sort, selectScreen = []) => {
|
|
var selectScreenStr = ''
|
|
// 过滤请求数组
|
|
selectScreen.forEach(function(element) {
|
|
for (var i = 0; i < element.classlist.length; i++) {
|
|
if (element.classlist[i].status) {
|
|
selectScreenStr += element.classlist[i].id + '/'
|
|
}
|
|
}
|
|
})
|
|
var data = {
|
|
offset,
|
|
limit: '15',
|
|
type,
|
|
sort,
|
|
courseId,
|
|
selectScreenStr
|
|
}
|
|
return fetch('/api/courselist', data)
|
|
}
|
|
/**
|
|
* 获取课程详情
|
|
*/
|
|
export const getDetail = (id) => {
|
|
fetch('/api/courseDetail/index/' + id)
|
|
}
|
|
|
|
/**
|
|
* 模糊查询
|
|
*/
|
|
export const getleckCourse = (name, offset) => {
|
|
let data = {
|
|
limit: '15',
|
|
offset,
|
|
name
|
|
}
|
|
return fetch('/api/getleckCourse', data)
|
|
}
|
|
|
|
/**
|
|
* 加入购物车
|
|
*/
|
|
|
|
export const postCourseId = (productCode, buyCount, memberId, mobile, productImg, productName, productPrice,
|
|
specifications, leftAllotment, basePiont) => {
|
|
var data = {
|
|
buyCount: buyCount,
|
|
memberId: memberId,
|
|
mobile: mobile,
|
|
productCode: productCode,
|
|
productImg: productImg,
|
|
productName: productName,
|
|
productPrice: productPrice,
|
|
specifications: specifications,
|
|
leftAllotment: leftAllotment,
|
|
basePiont: basePiont
|
|
}
|
|
return fetch('insertCartProductInfo', data, 'POST')
|
|
}
|
|
/**
|
|
* 是否存在购物车
|
|
*/
|
|
export const isexistCart = (id, pet, address) => {
|
|
var data = {}
|
|
return fetch('getCartProductInfo?memberId=' + id, data, 'POST')
|
|
}
|
|
|
|
/**
|
|
* 支付监听
|
|
*/
|
|
export const monitorOrderNotify = (OrderNumber) => {
|
|
var data = {}
|
|
return fetch('monitorOrderNotify?OrderNumber=' + OrderNumber, data, 'POST')
|
|
}
|
|
|
|
/**
|
|
* 删除购物车
|
|
*/
|
|
export const deleteCart = (productCode) => {
|
|
var data = {
|
|
productCode
|
|
}
|
|
return fetch('cancelCartProductInfo', productCode, 'POST')
|
|
}
|
|
/**
|
|
* 购物车批量提交
|
|
*/
|
|
export const mostAddClass = (id) => {
|
|
return fetch('/api/mostAddClass/', {
|
|
id
|
|
})
|
|
}
|
|
/**
|
|
* 删除购物车
|
|
*/
|
|
// export const deleteCart = (deleteArr = []) => {
|
|
|
|
|
|
|
|
// // 拿到数组处理一下把
|
|
// let id = deleteArr.join('-')
|
|
// return fetch('/api/deleteCart/', {id})
|
|
// }
|
|
/**
|
|
* 发送验证码
|
|
*/
|
|
export const sendMsg = (mobile, pet, address) => {
|
|
var data = {
|
|
phoneNumber: mobile,
|
|
}
|
|
return fetch('sendMsg', data, 'POST')
|
|
}
|
|
|
|
/**
|
|
* 发送验证码数据
|
|
*/
|
|
export const vadatnmsg = (msgNum, hash, tamp) => {
|
|
var data = {
|
|
msgNum: msgNum,
|
|
tamp: tamp,
|
|
hash: hash
|
|
}
|
|
return fetch('validateNum', data, 'POST')
|
|
}
|
|
|
|
/**
|
|
* 筛选标签
|
|
*/
|
|
export const userstype = (stype, pet, address) => {
|
|
var data = {
|
|
petType: 0,
|
|
}
|
|
return fetch('productSearchTag/query?petType=' + 0, data, 'POST')
|
|
}
|
|
/**
|
|
* 登录
|
|
*/
|
|
export const userLongin = (mobile, pet, address) => {
|
|
var data = {
|
|
id: '',
|
|
mobile: mobile,
|
|
}
|
|
return fetch('member?type=get', data, 'POST')
|
|
}
|
|
/**
|
|
* 登录和注册
|
|
*/
|
|
export const userregOrLogin = (mobile) => {
|
|
var data = {
|
|
id: '',
|
|
mobile: mobile,
|
|
}
|
|
return fetch('regOrLogin?phoneNumber=' + mobile, data, 'POST')
|
|
}
|
|
|
|
|
|
//注册
|
|
export const useredit = (mobile, pet, address) => {
|
|
var data = {
|
|
mobile: mobile,
|
|
memberName: '',
|
|
realName: '',
|
|
gender: '',
|
|
email: '',
|
|
openId: '',
|
|
unionId: '',
|
|
birthday: '',
|
|
provinceId: '',
|
|
cityId: '',
|
|
districtId: '',
|
|
storeCode: '',
|
|
remark: '',
|
|
memberMark: '',
|
|
|
|
remark: ''
|
|
}
|
|
return fetch('member?type=add', data, 'POST')
|
|
}
|
|
//查询标品全部信息
|
|
// export const userquery = (mobile, pet,address) => {
|
|
// var data = {
|
|
// channelId:"15",
|
|
// secret:'H5@2021'
|
|
|
|
// }
|
|
// return fetch('h5/brand/query', data, 'POST' )
|
|
// }
|
|
//点击商品全部信息
|
|
export const userquery = (stype, ) => {
|
|
|
|
console.log(stype);
|
|
var data = {
|
|
goodsName: stype
|
|
|
|
}
|
|
return fetch('goods?petType=' + stype, data, 'POST')
|
|
}
|
|
//处方信息
|
|
export const userque = (goodsName, petType, curPage, curRow) => {
|
|
if (!curPage)
|
|
curPage = 1;
|
|
if (!curRow)
|
|
curRow = 10;
|
|
let queryTail = '&page=' + curPage + '&rows=' + curRow;
|
|
let query = '?0';
|
|
if (goodsName)
|
|
query += '&goodsName=' + goodsName;
|
|
if (petType !== undefined && petType !== '') {
|
|
query += '&petType=' + petType;
|
|
}
|
|
query += queryTail;
|
|
var data = {}
|
|
return fetch('goods' + query, data, 'POST')
|
|
}
|
|
|
|
|
|
|
|
//标品全部信息
|
|
export const biaomessage = (stype, name, curPage, curRow) => {
|
|
if (!curPage)
|
|
curPage = 1;
|
|
if (!curRow)
|
|
curRow = 10;
|
|
let queryTail = '&page=' + curPage + '&rows=' + curRow;
|
|
if (stype.length > 1) {
|
|
let list = {};
|
|
stype.map(item => {
|
|
console.log(item);
|
|
list = item
|
|
})
|
|
var str = "?";
|
|
for (var key in list) {
|
|
str = str + key + "=" + list[key] + "&";
|
|
}
|
|
stype = str.substr(0, str.length - 1);
|
|
return fetch('product/query' + stype + queryTail, '', 'POST')
|
|
} else {
|
|
return fetch('product/query?petType=' + stype + queryTail, '', 'POST')
|
|
}
|
|
}
|
|
|
|
export const searchchanpin = (stype, usertype, curPage, curRow) => {
|
|
|
|
console.log(stype, usertype);
|
|
|
|
if (!curPage)
|
|
curPage = 1;
|
|
if (!curRow)
|
|
curRow = 10;
|
|
let queryTail = '&page=' + curPage + '&rows=' + curRow;
|
|
console.log(stype);
|
|
let list = {};
|
|
stype.map(item => {
|
|
console.log(item);
|
|
list = item
|
|
})
|
|
var str = "&";
|
|
for (var key in list) {
|
|
|
|
str = str + key + "=" + list[key] + "&";
|
|
}
|
|
str = str.substr(0, str.length - 1);
|
|
var data = {
|
|
page: 1,
|
|
row: 10
|
|
}
|
|
|
|
return fetch('product/query?petType=' + usertype + str + queryTail, data, 'POST')
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// var str = "?";
|
|
// for(var key in data){
|
|
// str = str + key + "=" + data[key] + "&";
|
|
// }
|
|
// str = str.substr(0,str.length-1);
|
|
|
|
|
|
//查询订单
|
|
export const userindent = (phoneNumber, orderNumber, page, rows) => {
|
|
var data = {};
|
|
if (phoneNumber) {
|
|
data.phoneNumber = phoneNumber;
|
|
}
|
|
if (orderNumber) {
|
|
data.orderNumber = orderNumber;
|
|
}
|
|
let url = 'orderMaster/?type=query';
|
|
if (page && rows) {
|
|
url = url + "&page=" + page + "&rows=" + rows;
|
|
}
|
|
return fetch(url, data, 'POST')
|
|
}
|
|
//查询订单详情
|
|
export const userin = (orderNumber, ) => {
|
|
var data = {
|
|
orderNumber: orderNumber,
|
|
}
|
|
return fetch('orderMaster/?type=query', data, 'POST')
|
|
}
|
|
|
|
|
|
|
|
//取消订单
|
|
export const canceldanhao = (phoneNumber, orderNumber) => {
|
|
var data = {
|
|
phoneNumber: phoneNumber,
|
|
orderNumber: orderNumber,
|
|
|
|
}
|
|
return fetch('cancelOrder/', data, 'POST')
|
|
}
|
|
|
|
|
|
export const biaomessa = (stype) => {
|
|
console.log(stype);
|
|
var data = {
|
|
name: stype,
|
|
page: 1,
|
|
row: 10
|
|
}
|
|
return fetch('product/query', data, 'POST')
|
|
}
|
|
|
|
export const biaome = (usertype, stype, curPage, rows) => {
|
|
if (!curPage)
|
|
curPage = 1;
|
|
if (!rows)
|
|
rows = 10;
|
|
let queryTail = '&page=' + curPage + '&rows=' + rows;
|
|
let username = '&name=' + stype
|
|
console.log(stype);
|
|
var data = {
|
|
name: stype,
|
|
rows: 10,
|
|
page: 1,
|
|
}
|
|
return fetch('product/query?petType=' + usertype + username + queryTail, data, 'POST')
|
|
}
|
|
|
|
|
|
|
|
//会员积分
|
|
export const memberAccount = (stype) => {
|
|
console.log(stype);
|
|
var data = {
|
|
memberId: stype
|
|
}
|
|
return fetch('memberAccount?type=history', data, 'POST')
|
|
}
|
|
|
|
|
|
//查询订单信息
|
|
export const ordermaster = (stype) => {
|
|
console.log(stype);
|
|
var data = {
|
|
|
|
memberId: '223782'
|
|
}
|
|
return fetch('memberAccount', data, 'POST')
|
|
}
|
|
|
|
//微信支付
|
|
export const payOrderWX = (stype) => {
|
|
console.log(stype);
|
|
var data = {
|
|
|
|
memberId: '223782'
|
|
}
|
|
return fetch('memberAccount', data, 'POST')
|
|
}
|
|
|
|
|
|
|
|
|
|
export const insercar = (stype) => {
|
|
console.log(stype);
|
|
var data = {
|
|
petType: stype
|
|
}
|
|
return fetch('product/insertCartProductInfo', data, 'POST')
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//查询猫狗商品信息
|
|
export const catquery = (productCode, type) => {
|
|
console.log(productCode);
|
|
var data = {
|
|
|
|
petType: 0
|
|
|
|
}
|
|
return fetch('h5/product/query', data, 'POST')
|
|
}
|
|
//查询猫狗商品信息
|
|
export const dogquery = (productCode, type) => {
|
|
console.log(productCode);
|
|
var data = {
|
|
|
|
petType: 1,
|
|
pet_type: 0
|
|
|
|
}
|
|
return fetch('h5/product/query', data, 'POST')
|
|
}
|
|
|
|
//查询商品信息
|
|
export const productQuery = (productCode) => {
|
|
let url = 'product/query';
|
|
if (productCode) {
|
|
url += '?productCode=' + encodeURI(productCode);
|
|
}
|
|
var data = {}
|
|
return fetch(url, data, 'POST')
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//查询单个商品
|
|
export const oncequery = (productCode) => {
|
|
|
|
var data = {
|
|
|
|
productCode: productCode
|
|
|
|
}
|
|
return fetch("goodsByProductCode?productCode=" + productCode, data, 'POST')
|
|
}
|
|
|
|
|
|
//查询单个商品
|
|
export const goodsmessage = (productCode) => {
|
|
|
|
var data = {
|
|
productCode: productCode
|
|
|
|
}
|
|
return fetch("productMaster/query?productCode=" + productCode, data, 'POST')
|
|
}
|
|
|
|
|
|
|
|
|
|
//优惠券的插入
|
|
export const inserdiscount = (mobile, couponId) => {
|
|
var data = {
|
|
mobile: mobile,
|
|
couponId: couponId
|
|
}
|
|
return fetch('coupon?type=fetch', data, 'POST')
|
|
}
|
|
|
|
|
|
//优惠券的查询
|
|
export const getdiscount = (memberId, channelSecurity, mobile) => {
|
|
var data = {
|
|
memberId: memberId,
|
|
mobile: mobile
|
|
}
|
|
return fetch('memberAddress?type=getAll', data, 'POST')
|
|
}
|
|
|
|
//可用的优惠券
|
|
export const alldiscount = (paramsObj) => {
|
|
var data = paramsObj;
|
|
return fetch('couponConfig?type=getAll', data, 'POST')
|
|
}
|
|
|
|
|
|
//用户领取的优惠券
|
|
export const getdraw = (paramsObj) => {
|
|
var data = paramsObj;
|
|
return fetch('coupon?type=getAll', data, 'POST')
|
|
}
|
|
|
|
|
|
//微信支付
|
|
export const generateOrderWX = (list, payType) => {
|
|
//Dictionary : 1: scan qrcode, 2:redirect 3: raise local app
|
|
if (payType == 1)
|
|
return fetch('generateOrderWX', list, 'POST')
|
|
else
|
|
return fetch('generateOrderWXH5', list, 'POST')
|
|
}
|
|
|
|
//再次支付
|
|
export const repayOrde = (ordernumber, payType) => {
|
|
//Dictionary : 1: scan qrcode, 2:redirect 3: raise local app
|
|
if (payType == 1)
|
|
return fetch('repayOrderWX?orderNo=' + ordernumber, '', 'POST')
|
|
else
|
|
return fetch('repayOrderWXH5?orderNo=' + ordernumber, '', 'POST')
|
|
}
|
|
//用户所有的优惠券
|
|
export const allConfig = (memberId, channelSecurity, mobile) => {
|
|
var data = {}
|
|
return fetch('couponConfig?type=getAll', data, 'POST')
|
|
}
|
|
|
|
|
|
//用户领取优惠券
|
|
export const getConfig = (memberId, couponId) => {
|
|
var data = {
|
|
memberId: memberId,
|
|
couponId: couponId,
|
|
}
|
|
return fetch('coupon?type=fetch', data, 'POST')
|
|
}
|
|
|
|
|
|
//用户下的优惠券
|
|
export const userConfig = (memberId, couponId) => {
|
|
var data = {
|
|
memberId: memberId,
|
|
couponId: couponId,
|
|
}
|
|
return fetch('coupon?type=fetch', data, 'POST')
|
|
}
|
|
|
|
|
|
|
|
|
|
//用户订单的查询
|
|
// export const customerorders = (memberId,channelSecurity,mobile) => {
|
|
// var data = {
|
|
// productName:'幼猫全价粮',
|
|
// buyCount:'2',
|
|
// productId:'210352',
|
|
// payAmount:'517',
|
|
// memberId:'844350',
|
|
// phoneNumber:'18112621098',
|
|
// }
|
|
// return fetch('generateOrderWX', data, 'POST' )
|
|
// }
|
|
|
|
|
|
//地址的查询
|
|
export const selectaddress = (memberId, pet, address) => {
|
|
var data = {
|
|
memberId: memberId,
|
|
}
|
|
return fetch('memberAddress?type=getAll', data, 'POST')
|
|
}
|
|
|
|
|
|
//地址的添加 //id/详细地址/ 收货人姓名/收货人电话号码/省份id/城市id/区域编码
|
|
export const editaddress = (memberId, detailAddress, recipient, tel, provinceId, cityId, districtId) => {
|
|
|
|
var data = {
|
|
memberId: 844350,
|
|
provinceId: 25,
|
|
cityId: 36,
|
|
districtId: 418,
|
|
detailAddress: '古美路1455弄46号302',
|
|
recipient: '蒋缘缘2',
|
|
recipientPhone: '13671516167',
|
|
zipCode: '214423',
|
|
default: false,
|
|
}
|
|
return fetch('memberAddress?type=add', memberId, 'POST')
|
|
}
|
|
|
|
//删除
|
|
export const editdelete = (memberId, ids) => {
|
|
var data = {
|
|
memberId: memberId,
|
|
ids: ids,
|
|
}
|
|
return fetch('memberAddress?type=delete', data, 'POST')
|
|
}
|
|
|
|
//地址的编辑
|
|
export const editupdate = (userid, ) => {
|
|
// var data = {
|
|
// memberId:userid,
|
|
// id:id,
|
|
// isDefault:isDefault,
|
|
// }
|
|
return fetch('memberAddress?type=update', userid, 'POST')
|
|
}
|
|
|
|
//修改密码
|
|
export const userchange = (id, pet, address) => {
|
|
var data = {
|
|
id: id,
|
|
}
|
|
return fetch('member?type=update', data, 'POST')
|
|
}
|
|
|
|
|
|
/**
|
|
* 登录
|
|
*/
|
|
|
|
export const getCartList = (user) => {
|
|
var data = {
|
|
user
|
|
}
|
|
return fetch('/api/cartList', data)
|
|
}
|
|
|
|
/**
|
|
* 提交订单
|
|
*/
|
|
|
|
export const submitOrder = (phone, id, total, oldOrder) => {
|
|
var data = {
|
|
phone,
|
|
id,
|
|
total,
|
|
oldOrder
|
|
}
|
|
return fetch('/api/submitOrder', data)
|
|
}
|
|
|
|
/**
|
|
* 支付成功
|
|
*/
|
|
|
|
export const paySuccess = (id, uers) => {
|
|
var data = {
|
|
id,
|
|
uers
|
|
}
|
|
return fetch('/api/paySuccess', data)
|
|
}
|
|
/**
|
|
* 请求订单列表
|
|
*/
|
|
|
|
export const getOrderList = (user, status) => {
|
|
var data = {
|
|
user,
|
|
status
|
|
}
|
|
return fetch('/api/getOrderList', data)
|
|
}
|
|
|
|
|
|
|
|
//购物车操作
|
|
export const memberAddress = (type, data) => {
|
|
return fetch('memberAddress?type=' + type, data, 'POST')
|
|
}
|
|
|
|
//购物车操作
|
|
export const changeCartNumber = (data) => {
|
|
return fetch('updateCartCount', data, 'POST')
|
|
}
|
|
|
|
|
|
|
|
|
|
//支付宝支付二维码
|
|
export const generateOrderAlipay = (orderNo, payType) => {
|
|
//Dictionary : 1: PC, 2: Mobile
|
|
let url = 'generateOrderAlipayPC';
|
|
if (payType == 2) {
|
|
url = 'generateOrderAlipayPhone'
|
|
}
|
|
var data = {
|
|
//orderNo:orderNo
|
|
}
|
|
url = url + "?orderNo=" + orderNo;
|
|
return fetch(url, data, 'POST')
|
|
//let ret = { "code": 1, "msg": "操作成功!", "success": true, "data": "<form name=\"punchout_form\" method=\"post\" action=\"https://openapi.alipay.com/gateway.do?charset=utf-8&method=alipay.trade.wap.pay&sign=GK1NjnOYPh%2BHTcTtuZg4YunsBNGPHiyc9BwXLx%2FG4G6Z7S8ILYy2E6VmxkGVwZEwZ1G5PA3u2eZxJN3ysyynL9uwG7L4jGQcOB6I2m1763VBi7euNiyMhimv5AYeXP4KiDtmZNDIAdyi3eKWemKTq74AfS0TTubYvKL8aqhJHTQy2GtYdXA89v53ZeFkXjoqpylwCf2j%2FJWD1nV1eO0a0PB5MFqPaZB5Eif69XkT1TNAt1eZiwIn4AO6yqMFJ41gGN5ymmLQUVcUgc5dxlGkMNgY4FUsI6mFYucQ%2BRPPmuH78YJTFU6VS5E%2BZ%2BCL%2BGLxeJs068n%2BLAPqpPqDbhveYg%3D%3D&return_url=https%3A%2F%2Fshop.royalcanin.com.cn¬ify_url=https%3A%2F%2Fshop.royalcanin.com.cn%2Froyalcanin%2Froyalcanin%2Froyalcanin%2FupdateOrderAliPay&version=1.0&app_id=2021003108690157&sign_type=RSA2×tamp=2022-02-14+15%3A08%3A05&alipay_sdk=alipay-sdk-java-dynamicVersionNo&format=json\">\n<input type=\"hidden\" name=\"biz_content\" value=\"{"out_trade_no":"02110014172230000","total_amount":"138.0","subject":"皇家宠物食品官方商城"}\">\n<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >\n</form>\n<script>document.forms[0].submit();</script>" };
|
|
//ret = JSON.parse(ret);
|
|
//return ret;
|
|
}
|