Skip to content

Commit

Permalink
dsshop2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tifaweb committed Jun 7, 2018
1 parent 741968e commit 02cbd62
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 37 deletions.
2 changes: 2 additions & 0 deletions 2.4.1更新说明.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1���޸������޷��������
2���޸�һЩҵ��BUG
2 changes: 0 additions & 2 deletions 2.4更新说明.txt

This file was deleted.

2 changes: 1 addition & 1 deletion Conf/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
'DS_ENTERPRISE' => 'Dswjcms独立商城系统',
'DS_EN_ENTERPRISE' => 'dsshop',
'DS_TOP_POWERED' => 'Powered by Dswjcms!',
'DS_POWERED' => '<p class="pull-left">Powered by <strong><a href="http://www.dswjcms.com" target="_blank">Dswjcms!</a></strong> <em>X2.4</em><br/>&copy; 2003-2018<a href="http://www.tifaweb.com" target="_blank">Tf Inc.</a></p>',
'DS_POWERED' => '<p class="pull-left">Powered by <strong><a href="http://www.dswjcms.com" target="_blank">Dswjcms!</a></strong> <em>X2.4.1</em><br/>&copy; 2003-2018<a href="http://www.tifaweb.com" target="_blank">Tf Inc.</a></p>',


);
Expand Down
4 changes: 2 additions & 2 deletions Lib/Action/Api/IndexAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class IndexAction extends CommAction {
//微信openid获取
public function getwxopenID(){
if(I('get.code')){
$data['appid']='wxc31e70f47087660b'; //小程序appid
$data['secret']='5a8d778a3ca34748dcea69ea7f40a4a4'; //小程序secret
$data['appid']=''; //小程序appid
$data['secret']=''; //小程序secret
$data['js_code']=I('get.code');
$data['grant_type']="authorization_code";
$Curl=$this->Curl($data,'https://api.weixin.qq.com/sns/jscode2session');
Expand Down
6 changes: 3 additions & 3 deletions Lib/Plugin/wxpay/WxPay.Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class WxPayConfig
* 获取地址:https://mp.weixin.qq.com/advanced/advanced?action=dev&t=advanced/dev&token=2005451881&lang=zh_CN
* @var string
*/
const APPID = 'wxc31e70f47087660b';
const MCHID = '1282414301';
const KEY = 'tifawebcomDswjcmscom251414195232';
const APPID = '';
const MCHID = '';
const KEY = '';
const APPSECRET = '';

//=======【证书路径设置】=====================================
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ dsshop是一套轻量级的网上购物系统,通过dsshop可以快速搭建

2、微信小程序后端需要搭建在服务器上才可在微信小程序中被配置

# Dsshop版本说明

2018年06月07日 2.4.1发布,修复部分BUG


# Dsshop使用要求

Expand Down Expand Up @@ -76,9 +80,11 @@ http://dswjshopbasis.tifaweb.com

3、导入项目成功后,需要修改config.js,在微信开发者工具中,点击config.js文件,找到“var host = "填写自己的服务器地址"”,修改地址为服务器地址(即服务器访问的dsshop项目地址)

4、修改代码里的信息,然后上传,微信小程序后台提示
4、修改dsshop(PHP端),路径:Lib\Action\Api\IndexAction.class.php里的getwxopenID方法,将小程序appid和小程序secret填写上去

5、修改代码里的信息,然后上传,微信小程序后台提示

5、项目对外发布,上线运营
6、项目对外发布,上线运营

# dsshop微信小程序演示地址

Expand Down
3 changes: 2 additions & 1 deletion Tpl/Admin/Basis/editshu.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
</td>
<td>
<select name="type">
<option value="0">首页轮播</option>
<option value="0" <neq name="ed.type" value="1">selected</neq>>首页轮播</option>
<option value="1" <eq name="ed.type" value="1">selected</eq>>微信小程序轮播</option>
</select>
</td>
</tr>
Expand Down
27 changes: 26 additions & 1 deletion dsshop/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ App({
code: data.code
},
success: function (res) {

//console.log(res);
if (res.data.status == 1) { //成功
self.globalData.openid = res.data.info.openid;
self.globalData.uid = res.data.info.id;
Expand Down Expand Up @@ -209,5 +209,30 @@ App({
// data: setcart
// })
},
/**
* 购买处理
* id 商品ID
* color 颜色
* size 尺寸
* nub 数量
*/
setgoods(id, color, size, nub) {
//wx.removeStorageSync('getgoods')
var code, setcart = {};
if (wx.getStorageSync('getgoods')) {
setcart = wx.getStorageSync('getgoods');
}

code = id + '-' + color + '-' + size;

setcart[code] = {};
setcart[code]['nub'] = nub;

setcart[code]['id'] = id;
setcart[code]['color'] = color;
setcart[code]['size'] = size;
wx.setStorageSync('getgoods', setcart);

},
})

4 changes: 2 additions & 2 deletions dsshop/page/component/pages/address/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const uploadImgUrl = require('../../../../config').uploadImgUrl
const getUrl = require('../../../../config').getUrl
Page({
data: {
region:'请选择区域'

region:'请选择区域',
cityarray:[]
},
onLoad: function (options) {
var title,that=this;
Expand Down
7 changes: 6 additions & 1 deletion dsshop/page/component/pages/details/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,12 @@ Page({
})

}else{ //购买

var app = getApp();
app.setgoods(this.data.getid, colorValue, sizeValue, numberValue);
//直接下单
wx.navigateTo({
url: 'makeorder?type=1'
})
}
this.setData({
showBottomPopup: !this.data.showBottomPopup,
Expand Down
80 changes: 58 additions & 22 deletions dsshop/page/component/pages/details/makeorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ Page({

},
onLoad: function (options) {

if (options.type==1){
this.setData({
type: options.type,
});
}

this.getaddress();
this.getCarList();

Expand Down Expand Up @@ -44,20 +51,33 @@ Page({
},
//获取购物车列表
getCarList() {
var getcart = wx.getStorageSync('getcart'), getcartselected = wx.getStorageSync('getcartselected'), cartdata = {}, getCheckbox = {}, getCheckboxColor = {}, getid = {}, that = this;

if (!getcart) {
console.log('非法操作');
return false;
}
var getcart = wx.getStorageSync('getcart'), getgoods = wx.getStorageSync('getgoods'), getcartselected = wx.getStorageSync('getcartselected'), cartdata = {}, getCheckbox = {}, getCheckboxColor = {}, getid = {}, that = this;
if (this.data.type==1){ //直接购买

if (!getgoods) {
console.log('非法操作');
return false;
}

for (var i in getcart) {
if (getcartselected.hasOwnProperty(i)){
for (var i in getgoods) {
getid[i] = i;
}

}else{ //购物车
if (!getcart) {
console.log('非法操作');
return false;
}

for (var i in getcart) {
if (getcartselected.hasOwnProperty(i)) {
getid[i] = i;
}

}
}


wx.request({
url: getUrl + 'getCarGoods',
data: {
Expand All @@ -70,32 +90,39 @@ Page({

if (res.data.status == 1) {

var getdata = res.data.info, price = 0, nub = 0;

for (var i in getcart) {
if (getcartselected.hasOwnProperty(i)) {
var getdatas = {} = getdata[getcart[i]['id']];
var getdata = res.data.info, price = 0, nub = 0, ordgetcart;
if (that.data.type == 1){
ordgetcart = getgoods;
}else{
ordgetcart = getcart;
}

for (var i in ordgetcart) {
if (getcartselected.hasOwnProperty(i) || that.data.type ==1) {
var getdatas = {} = getdata[ordgetcart[i]['id']];

cartdata[i] = {};
cartdata[i]['id'] = getdatas['id'];
cartdata[i]['title'] = getdatas['title'];
cartdata[i]['zimg'] = getdatas['zimg'];
cartdata[i]['color'] = getdatas['attribute']['color'][getcart[i]['color']];
cartdata[i]['size'] = getdatas['attribute']['size'][getcart[i]['size']];
cartdata[i]['p'] = parseInt(getcart[i]['color']) * getdatas['attribute']['size'].length + parseInt(getcart[i]['size']); //键名
cartdata[i]['color'] = getdatas['attribute']['color'][ordgetcart[i]['color']];
cartdata[i]['size'] = getdatas['attribute']['size'][ordgetcart[i]['size']];
cartdata[i]['p'] = parseInt(ordgetcart[i]['color']) * getdatas['attribute']['size'].length + parseInt(ordgetcart[i]['size']); //键名

cartdata[i]['nub'] = getcart[i]['nub']; //当前购物车数量
cartdata[i]['nub'] = ordgetcart[i]['nub']; //当前购物车数量
cartdata[i]['price'] = getdatas['attribute']['price'][cartdata[i]['p']]//价格
price += parseInt(cartdata[i]['price']);
nub+=1;
}
}

//console.log(price);
that.setData({
cartList: cartdata,
statisticalPrice: that.fmoney(price, 2),
statisticalNum: nub,
});

} else {
wx.showToast({
title: res.data.info,
Expand Down Expand Up @@ -137,21 +164,30 @@ Page({
},
//提交订单
getGenerateOrders() {
var getcart = wx.getStorageSync('getcart'), getid = {},getcartselected = wx.getStorageSync('getcartselected'), addressid = this.data.addressid;
if (!addressid){
var getcart = wx.getStorageSync('getcart'), getgoods = wx.getStorageSync('getgoods'), getid = {},getcartselected = wx.getStorageSync('getcartselected'), addressid = this.data.addressid;
if (!addressid) {
wx.showToast({
title: '请选择收货信息',
icon: 'none',
duration: 2000
})
return false;
}
for (var i in getcart) {
if (getcartselected.hasOwnProperty(i)) {
getid[i] = getcart[i];
if (this.data.type == 1) { //直接购买
for (var i in getgoods) {
getid[i] = getgoods[i];
}
}else{

for (var i in getcart) {
if (getcartselected.hasOwnProperty(i)) {
getid[i] = getcart[i];
}

}
}

//console.log(getid);
wx.request({
url: getUrl + 'getGenerateOrders',
data: {
Expand Down

0 comments on commit 02cbd62

Please sign in to comment.