Skip to content

Commit

Permalink
modified
Browse files Browse the repository at this point in the history
  • Loading branch information
toby20130333 committed Apr 12, 2016
1 parent cc06122 commit 69da7ca
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 15 deletions.
3 changes: 3 additions & 0 deletions DriverQtVersion.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ RESOURCES += qml.qrc \
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

MOC_DIR =./tmp/moc
UI_DIR = ./tmp/ui
OBJECTS_DIR = ./tmp/obj

DEFINES += USE_YOUZAN

Expand Down
1 change: 0 additions & 1 deletion ddquickview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ void YbQuickView::setHasMouse(bool isHasMouse)
void YbQuickView::setSourceAndRegsiterObj(const QUrl &url, bool regsiter)
{
#ifdef USE_YOUZAN
YouZanObject yZObj;
this->rootContext()->setContextProperty("yzObj", &yZObj);
#endif
setSource(url);
Expand Down
1 change: 1 addition & 0 deletions ddquickview.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class YbQuickView : public QQuickView
bool canMove;

QObject *m_Obj;
YouZanObject yZObj;
public slots:
void slotFinishedAnimation1();
void slotFinishedAnimation2();
Expand Down
3 changes: 2 additions & 1 deletion ddview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void DDView::mouseReleaseEvent(QMouseEvent *e)
{
return QQuickView::mouseReleaseEvent(e);
}

#ifdef Q_OS_WIN
bool DDView::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
if (this->minimumHeight() >= this->maximumHeight()
Expand Down Expand Up @@ -97,3 +97,4 @@ bool DDView::nativeEvent(const QByteArray &eventType, void *message, long *resul
}
return QQuickView::nativeEvent(eventType, message, result);;
}
#endif
6 changes: 4 additions & 2 deletions ddview.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

#include <QObject>
#include <QQuickView>
#ifdef Q_OS_WIN
#include <WindowsX.h>
#endif
#include <QMouseEvent>

class DDView : public QQuickView
Expand All @@ -19,13 +21,13 @@ class DDView : public QQuickView
virtual void mouseMoveEvent(QMouseEvent *e);
virtual void mousePressEvent(QMouseEvent *e);
virtual void mouseReleaseEvent(QMouseEvent *e);

#ifdef Q_OS_WIN
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
#else
bool winEvent ( MSG * message, long * result );
#endif

#endif
private:
int m_shadowSize;
};
Expand Down
8 changes: 8 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ int main(int argc, char *argv[])
#ifdef USE_YOUZAN
view.setMaximumWidth(500);
view.setMaximumHeight(460);
#ifdef Q_OS_MACX
view.setSourceAndRegsiterObj(QUrl::fromLocalFile("../../../youzan/main.qml"));
#else
view.setSourceAndRegsiterObj(QUrl::fromLocalFile("youzan/main.qml"));
#endif
#elif USE_DRIVER
#ifdef Q_OS_MACX
view.setSourceAndRegsiterObj(QUrl::fromLocalFile("../../../Driver/DDDriverView.qml"));
#else
view.setSourceAndRegsiterObj(QUrl::fromLocalFile("Driver/DDDriverView.qml"));
#endif
#else
view.setSourceAndRegsiterObj(QUrl::fromLocalFile("XunLei/DDXunLei.qml"));
#endif
Expand Down
12 changes: 6 additions & 6 deletions youzan/YouZanApi.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ ListView{
zanFee: fee //总价
zanCreateTime: createTime //创建时间
zantrade: paytype //交易类型
zanImg: imgpath
onSignalClicked: {
//每个订单的打印按钮
yzObj.setCurrentPrintContents(gethtmlcontents());
yzObj.openPrinfDialog(true);
}
}
Component.onCompleted: {
searchTrades("2016-03-09 00:00:00","2016-04-20 00:00:00")
searchTrades("2016-03-09 00:00:00","2016-04-10 00:00:00")
}

function searchTrades(startDate,endDate){
Expand All @@ -51,13 +52,13 @@ ListView{
if(defference){
var titletotal="";
var price ="0";
var zanCount = "0";
var zanCount = 0;
var pic_path = "";
var orders=data.response.trades[i].orders;
for(var a=0;a<orders.length;a++){
price = orders[0].price;
pic_path = orders[0].pic_path;
zanCount +=+orders[a].num;
zanCount +=orders[a].num;
titletotal+=(" "+orders[a].title);
}
var sum=0.0;
Expand Down Expand Up @@ -116,9 +117,8 @@ ListView{
var startCreated=startDate;
var endCreadted=endDate;

var secret="xxxx";
var appid="xxxx";

var secret="f2c68e2077866802c2eb840d0fe201b3";
var appid="fb28eaabc526f7899b";
var currentDate=new Date();
var method="kdt.trades.sold.get";//调用第三方接口函数

Expand Down
10 changes: 9 additions & 1 deletion youzan/YouZanView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,15 @@ Item {
refreshBtn.color = "#12AADF";
}
onClicked: {

for(var i=0;i<yz.modelCount;i++){
console.log("----qml-------"+i);
if(yz.currentIndex>=yz.modelCount){
yz.currentIndex = 0;
}
yzObj.setCurrentPrintContents(yz.currentItem.gethtmlcontents());
yz.currentIndex = i+1;
}
yzObj.openPrinfDialog(true);
}
}

Expand Down
8 changes: 4 additions & 4 deletions youzan/YouzanItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Item{
anchors.fill: parent
anchors.margins: 10
readOnly: true
clip:true
textFormat: TextEdit.RichText
text: "<br><font color='#12AADF'>*订单号</font>: "+zanId+" No: "+(index+1)+"<br><br><font color='#12AADF'>*商品名</font>: "+zanProductName
+"<br><br><font color='#12AADF'>*数量</font>: "+zanCount+"<br><br><font color='#12AADF'>*单价</font>: "+zanPrice+"元<br><br><font color='#12AADF'>*应付</font>: "+zanFee
Expand All @@ -83,15 +84,14 @@ Item{
verticalAlignment: Text.AlignVCenter
color: "black"
}
Image {
BorderImage {
id: imgUrl
source: zanImg
width: 96
height: width
anchors.right: parent.right
anchors.rightMargin: 10
anchors.top: midRect.top
anchors.topMargin: 40
anchors.verticalCenter: parent.verticalCenter
z:20
smooth: true
}
Expand Down Expand Up @@ -129,7 +129,7 @@ Item{
}

function gethtmlcontents(){
console.log("text is "+name2.text)
//console.log("text is "+name2.text)
return name2.text;
}
}
Expand Down
1 change: 1 addition & 0 deletions youzan/youzanobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ void YouZanObject::setCurrentPrintContents(const QString &html)
{
if(mHtmlList.contains(html))return;
mHtmlList.append(html);
qDebug()<<"setCurrentPrintContents "<<mHtmlList.size();
}

0 comments on commit 69da7ca

Please sign in to comment.