123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373 |
- $PBExportHeader$w_fx_address.srw
- forward
- global type w_fx_address from w_publ_base_style
- end type
- type cb_add from uo_imflatbutton within w_fx_address
- end type
- type cb_edit from uo_imflatbutton within w_fx_address
- end type
- type cb_del from uo_imflatbutton within w_fx_address
- end type
- type dw_1 from datawindow within w_fx_address
- end type
- type cb_default from uo_imflatbutton within w_fx_address
- end type
- end forward
- global type w_fx_address from w_publ_base_style
- integer width = 1847
- integer height = 1508
- string title = "地址管理"
- cb_add cb_add
- cb_edit cb_edit
- cb_del cb_del
- dw_1 dw_1
- cb_default cb_default
- end type
- global w_fx_address w_fx_address
- type variables
- long ins_modcol = 3
- long modifyrow_no=0,crl_row //当前行记录
- end variables
- forward prototypes
- public subroutine wf_refresh ()
- public function integer wf_face_change ()
- end prototypes
- public subroutine wf_refresh ();string arg_msg
- oleobject req, rsp
- req = FxAppCom.CreatePbDictionary()
- req.setString('token', app_token_fx)
- rsp = FxAppCom.DoExecute('GetCusAddressList', req)
- arg_msg = rsp.getString('ErrMsg')
- if arg_msg <> '' then
- messagebox('错误', '获取地址信息失败:' + arg_msg)
- return
- end if
- oleobject addressList,item
- long cnt, i
- addressList = rsp.getPbArray('addressList')
- cnt = addressList.count
- dw_1.reset()
- dw_1.setRedraw(false)
- for i = 1 to cnt
- item = FxAppCom.CreatePbDictionary()
- item = addressList.GetPBDictionary(i - 1)
-
- dw_1.insertRow(0)
- dw_1.Object.addressid[i] = item.getInt('addressid')
- dw_1.Object.cus_rep[i] = item.getString('cus_rep')
- dw_1.Object.cus_tele[i] = item.getString('cus_tele')
- dw_1.Object.cus_address[i] = item.getString('cus_address')
- dw_1.Object.freight[i] = item.getString('freight')
- dw_1.Object.freight_tele[i] = item.getString('freight_tele')
- dw_1.Object.ifdefault[i] = item.getInt('ifdefault')
-
- next
- dw_1.setRedraw(true)
- end subroutine
- public function integer wf_face_change ();IF dw_edit_mode THEN
- cb_func.Enabled = FALSE
- cb_del.Enabled = FALSE
-
- cb_edit.Text = "放弃&E"
- cb_add.Text = "保存&S"
- cb_edit.normalpicname = 'Undo.bmp'
- cb_add.normalpicname = 'Save.bmp'
- ELSE
- cb_func.Enabled = TRUE
- cb_del.Enabled = TRUE
-
- cb_edit.Text = "修改&E"
- cb_add.Text = "新建&S"
- cb_edit.normalpicname = 'OPEN.bmp'
- cb_add.normalpicname = 'new.bmp'
- END IF
- cb_edit.of_init_draw()
- cb_add.of_init_draw()
- cb_edit.of_paint()
- cb_add.of_paint()
- cb_add.TriggerEvent('ue_textchange')
- cb_edit.TriggerEvent('ue_textchange')
- RETURN 1
- end function
- on w_fx_address.create
- int iCurrent
- call super::create
- this.cb_add=create cb_add
- this.cb_edit=create cb_edit
- this.cb_del=create cb_del
- this.dw_1=create dw_1
- this.cb_default=create cb_default
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.cb_add
- this.Control[iCurrent+2]=this.cb_edit
- this.Control[iCurrent+3]=this.cb_del
- this.Control[iCurrent+4]=this.dw_1
- this.Control[iCurrent+5]=this.cb_default
- end on
- on w_fx_address.destroy
- call super::destroy
- destroy(this.cb_add)
- destroy(this.cb_edit)
- destroy(this.cb_del)
- destroy(this.dw_1)
- destroy(this.cb_default)
- end on
- event open;call super::open;wf_refresh()
- end event
- event resize;call super::resize;dw_1.width = newwidth
- end event
- type cb_func from w_publ_base_style`cb_func within w_fx_address
- integer x = 512
- integer width = 165
- string text = "刷新"
- end type
- type cb_exit from w_publ_base_style`cb_exit within w_fx_address
- integer x = 960
- end type
- type ln_bar from w_publ_base_style`ln_bar within w_fx_address
- end type
- type ln_bar2 from w_publ_base_style`ln_bar2 within w_fx_address
- end type
- type r_bar from w_publ_base_style`r_bar within w_fx_address
- end type
- type cb_add from uo_imflatbutton within w_fx_address
- integer width = 165
- integer height = 164
- integer taborder = 20
- boolean bringtotop = true
- string text = "新增"
- string normalpicname = "New.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;long row, i
- string arg_msg
- row = dw_1.getRow()
- if dw_edit_mode then
- dw_1.AcceptText()
-
- if dw_1.Object.cus_rep[row] = '' then
- messagebox('error', '收货人不能为空')
- return
- elseif dw_1.Object.cus_tele[row] = '' then
- messagebox('error', '收货人电话不能为空')
- return
- elseif dw_1.Object.cus_address[row] = '' then
- messagebox('error', '收货地址不能为空')
- return
- end if
-
- oleobject address
- address = FxAppCom.CreatePbDictionary()
- if ISNULL(dw_1.Object.addressid[row]) then
- address.setInt('addressid', 0)
- else
- address.setInt('addressid', dw_1.Object.addressid[row])
- end if
- address.setString('cus_rep', dw_1.Object.cus_rep[row])
- address.setString('cus_tele', dw_1.Object.cus_tele[row])
- address.setString('cus_address', dw_1.Object.cus_address[row])
- address.setString('freight', dw_1.Object.freight[row])
- address.setString('freight_tele', dw_1.Object.freight_tele[row])
-
- oleobject req, rsp
- req = FXAppCom.CreatePbDictionary()
- req.setString('token', app_token_fx)
- req.setObject('address', address)
- rsp = FXAppCom.DoExecute('SaveCusAddress', req)
- arg_msg = rsp.GetString('ErrMsg')
- if arg_msg <> '' then
- messagebox('error', arg_msg)
- else
- messagebox('success', '保存成功')
- For i = 1 To ins_modcol
- dw_1.SetTabOrder ( i, 0 )
- Next
- end if
-
- wf_refresh()
-
- else
- Long li_row, li_cur_row
- li_cur_row = dw_1.GetRow()
- li_row = dw_1.InsertRow (0)
- For i = 1 To ins_modcol
- dw_1.SetTabOrder ( i, i*10 )
- Next
- dw_1.SelectRow(0,False)
- dw_1.ScrollToRow (li_row)
- dw_1.SelectRow(li_row,True)
- dw_1.SetFocus()
- modifyrow_no = li_row
-
- end if
-
- dw_edit_mode = Not dw_edit_mode
- WF_FACE_CHANGE()
- end event
- type cb_edit from uo_imflatbutton within w_fx_address
- integer x = 174
- integer width = 165
- integer height = 164
- integer taborder = 10
- boolean bringtotop = true
- string text = "修改"
- string normalpicname = "Open.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;long i
- If dw_edit_mode Then
- If dw_1.GetItemStatus(dw_1.GetRow(), 0, Primary!) = New! Then
- dw_1.DeleteRow(dw_1.GetRow())
- End If
- For i = 1 To ins_modcol
- dw_1.SetTabOrder ( i, 0 )
- Next
- modifyrow_no = 0
- wf_refresh()
- Else
- modifyrow_no = dw_1.GetRow()
-
- For i = 1 To ins_modcol
- dw_1.SetTabOrder ( i, i*10)
- Next
-
-
- dw_1.SetFocus()
- dw_1.SelectRow(0,False)
- dw_1.ScrollToRow (modifyrow_no)
- dw_1.SelectRow(modifyrow_no,True)
- End If
- dw_edit_mode = Not dw_edit_mode
- WF_FACE_CHANGE()
- end event
- type cb_del from uo_imflatbutton within w_fx_address
- integer x = 343
- integer width = 165
- integer height = 164
- integer taborder = 10
- boolean bringtotop = true
- string text = "删除"
- string normalpicname = "Delete.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;long row
- row = dw_1.getRow()
- if row <= 0 then
- return
- end if
- string arg_msg
- oleobject req,rsp
- req = FxAppCom.CreatePbDictionary()
- req.setString('token', app_token_fx)
- req.setInt('addressid', dw_1.Object.addressid[row])
- rsp = FxAppCom.DoExecute('DelCusAddress', req)
- arg_msg = rsp.getString('ErrMsg')
- if arg_msg <> '' then
- messagebox('错误', '删除地址失败:' + arg_msg)
- else
- messagebox('成功', '删除地址成功')
- end if
- wf_refresh()
- end event
- type dw_1 from datawindow within w_fx_address
- integer y = 176
- integer width = 1833
- integer height = 1252
- integer taborder = 20
- boolean bringtotop = true
- string title = "none"
- string dataobject = "dw_fx_address"
- boolean hscrollbar = true
- boolean vscrollbar = true
- boolean livescroll = true
- borderstyle borderstyle = stylelowered!
- end type
- event rowfocuschanged;IF modifyrow_no >0 AND dw_edit_mode THEN
- THIS.SETROW(modifyrow_no)
- THIS.ScrollToRow(modifyrow_no)
- else
- this.selectrow(0,false)
- this.selectrow(currentrow,true)
- END IF
- end event
- type cb_default from uo_imflatbutton within w_fx_address
- integer x = 681
- integer width = 274
- integer height = 164
- integer taborder = 20
- boolean bringtotop = true
- string text = "设为默认"
- string normalpicname = "Delete.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;long row
- row = dw_1.getRow()
- if row <= 0 then
- return
- end if
- string arg_msg
- oleobject req,rsp
- req = FxAppCom.CreatePbDictionary()
- req.setString('token', app_token_fx)
- req.setInt('addressid', dw_1.Object.addressid[row])
- rsp = FxAppCom.DoExecute('SetDefaultAddress', req)
- arg_msg = rsp.getString('ErrMsg')
- if arg_msg <> '' then
- messagebox('错误', '设置默认地址失败:' + arg_msg)
- else
- messagebox('成功', '设默认地址成功')
- end if
- wf_refresh()
- end event
|