Commit 2a92106251a96712ebb2c879909eeb28c56f2d1e
1 parent
70e3c1b8
订单列表增加卡项(暂时隐藏)
Showing
3 changed files
with
551 additions
and
24 deletions
pages/user/order_list/order_list.js
1 | const app = getApp(); | 1 | const app = getApp(); |
2 | +let self = null; | ||
2 | var t = function(t) { | 3 | var t = function(t) { |
3 | return t && t.__esModule ? t : { | 4 | return t && t.__esModule ? t : { |
4 | default: t | 5 | default: t |
@@ -36,6 +37,16 @@ Page({ | @@ -36,6 +37,16 @@ Page({ | ||
36 | name: "待评价", | 37 | name: "待评价", |
37 | id: 4 | 38 | id: 4 |
38 | }], | 39 | }], |
40 | + tab_serviceCard: [{ | ||
41 | + name: "全部", | ||
42 | + id: 0, | ||
43 | + },{ | ||
44 | + name: "待付款", | ||
45 | + id: 1, | ||
46 | + },{ | ||
47 | + name: "待评价", | ||
48 | + id: 2, | ||
49 | + }], | ||
39 | activeCategoryId: 0, | 50 | activeCategoryId: 0, |
40 | orderList: null, | 51 | orderList: null, |
41 | currentPage: 1, | 52 | currentPage: 1, |
@@ -50,6 +61,7 @@ Page({ | @@ -50,6 +61,7 @@ Page({ | ||
50 | 61 | ||
51 | back_goods_arr:null, //返回商品的列表 | 62 | back_goods_arr:null, //返回商品的列表 |
52 | currentIndex: 0, | 63 | currentIndex: 0, |
64 | + tabIndex: 0, | ||
53 | 65 | ||
54 | startDate: '', | 66 | startDate: '', |
55 | endDate: '', | 67 | endDate: '', |
@@ -60,11 +72,12 @@ Page({ | @@ -60,11 +72,12 @@ Page({ | ||
60 | is_no_data2: 0, | 72 | is_no_data2: 0, |
61 | is_no_more2: 0, | 73 | is_no_more2: 0, |
62 | 74 | ||
63 | - | 75 | + cardList: [], |
64 | // 搜索内容 | 76 | // 搜索内容 |
65 | searchContent: '', | 77 | searchContent: '', |
66 | }, | 78 | }, |
67 | onLoad: function(t) { | 79 | onLoad: function(t) { |
80 | + self = this; | ||
68 | // 设置日期选择器的结束时间为当前日期 | 81 | // 设置日期选择器的结束时间为当前日期 |
69 | var now=new Date(); | 82 | var now=new Date(); |
70 | var nowDate = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate(); | 83 | var nowDate = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate(); |
@@ -329,6 +342,7 @@ Page({ | @@ -329,6 +342,7 @@ Page({ | ||
329 | wx.stopPullDownRefresh(); | 342 | wx.stopPullDownRefresh(); |
330 | }, null, {store_id: os.stoid, user_id: oo.user_id}); | 343 | }, null, {store_id: os.stoid, user_id: oo.user_id}); |
331 | }, | 344 | }, |
345 | + | ||
332 | //滑倒底部 | 346 | //滑倒底部 |
333 | onReachBottom: function() { | 347 | onReachBottom: function() { |
334 | if(this.data.currentIndex == 0) { | 348 | if(this.data.currentIndex == 0) { |
@@ -339,13 +353,23 @@ Page({ | @@ -339,13 +353,23 @@ Page({ | ||
339 | } | 353 | } |
340 | s.canloadMore() && this.requestOrderList(this.data.activeCategoryId); | 354 | s.canloadMore() && this.requestOrderList(this.data.activeCategoryId); |
341 | } else { | 355 | } else { |
342 | - this.request_list({ | ||
343 | - store_id: os.stoid, | ||
344 | - user_id: oo.user_id, | 356 | + if(this.data.currentIndex == 1) { |
357 | + this.request_list({ | ||
358 | + store_id: os.stoid, | ||
359 | + user_id: oo.user_id, | ||
345 | page: this.data.currentPage2, | 360 | page: this.data.currentPage2, |
346 | - }); | 361 | + }); |
362 | + } else { // 卡项订单 | ||
363 | + this.request_list({ | ||
364 | + store_id: os.stoid, | ||
365 | + user_id: oo.user_id, | ||
366 | + page: this.data.currentPage2, | ||
367 | + }); | ||
368 | + } | ||
369 | + | ||
347 | } | 370 | } |
348 | }, | 371 | }, |
372 | + | ||
349 | onPullDownRefresh: function(t) { | 373 | onPullDownRefresh: function(t) { |
350 | // sty取消 | 374 | // sty取消 |
351 | // this.resetData(), this.requestOrderList(this.data.activeCategoryId); | 375 | // this.resetData(), this.requestOrderList(this.data.activeCategoryId); |
@@ -1799,8 +1823,16 @@ Page({ | @@ -1799,8 +1823,16 @@ Page({ | ||
1799 | // var req_data = { | 1823 | // var req_data = { |
1800 | // page:th.data.currentPage2 | 1824 | // page:th.data.currentPage2 |
1801 | // } | 1825 | // } |
1802 | - | ||
1803 | - app.request.promiseGet("/api/weshop/order/pagePosOrder", { | 1826 | + let currentIndex = this.data.currentIndex; |
1827 | + let url = ''; | ||
1828 | + if(currentIndex == 1) { | ||
1829 | + url = '/api/weshop/order/pagePosOrder'; | ||
1830 | + }; | ||
1831 | + if(currentIndex == 2) { | ||
1832 | + url = '/api/weshop/recharge/user/page'; | ||
1833 | + }; | ||
1834 | + | ||
1835 | + app.request.promiseGet(url, { | ||
1804 | data: data | 1836 | data: data |
1805 | }).then(res=>{ | 1837 | }).then(res=>{ |
1806 | // 关闭加载状态 | 1838 | // 关闭加载状态 |
@@ -1812,9 +1844,20 @@ Page({ | @@ -1812,9 +1844,20 @@ Page({ | ||
1812 | var data = res.data.data.pageData; | 1844 | var data = res.data.data.pageData; |
1813 | // 判断有无更多数据可以加载,如果大于则没有更多数据,反之则有 | 1845 | // 判断有无更多数据可以加载,如果大于则没有更多数据,反之则有 |
1814 | if(res.data.data.page*res.data.data.pageSize > res.data.data.total){th.setData({is_no_more2:1});} | 1846 | if(res.data.data.page*res.data.data.pageSize > res.data.data.total){th.setData({is_no_more2:1});} |
1815 | - var list=th.data.list2; | ||
1816 | - list=list.concat(data); | ||
1817 | - th.setData({list2:list}); | 1847 | + let list= []; |
1848 | + | ||
1849 | + if(currentIndex == 1) { | ||
1850 | + list = th.data.list2; | ||
1851 | + list = list.concat(data); | ||
1852 | + th.setData({list2:list}); | ||
1853 | + }; | ||
1854 | + if(currentIndex == 2) { // 卡项订单 | ||
1855 | + list = th.data.cardList; | ||
1856 | + list = list.concat(data); | ||
1857 | + th.setData({cardList:list}); | ||
1858 | + console.log('currentCard', list); | ||
1859 | + }; | ||
1860 | + | ||
1818 | } else { | 1861 | } else { |
1819 | if(th.data.currentPage2==1){ | 1862 | if(th.data.currentPage2==1){ |
1820 | th.setData({is_no_data2:1}); | 1863 | th.setData({is_no_data2:1}); |
@@ -1839,7 +1882,7 @@ Page({ | @@ -1839,7 +1882,7 @@ Page({ | ||
1839 | this.setData({ | 1882 | this.setData({ |
1840 | currentIndex: currentIndex | 1883 | currentIndex: currentIndex |
1841 | }); | 1884 | }); |
1842 | - console.log(this.data.currentIndex); | 1885 | + |
1843 | this.setData({ | 1886 | this.setData({ |
1844 | is_no_data2: 0, | 1887 | is_no_data2: 0, |
1845 | is_no_more2: 0, | 1888 | is_no_more2: 0, |
@@ -1852,7 +1895,8 @@ Page({ | @@ -1852,7 +1895,8 @@ Page({ | ||
1852 | startDate: '选择开始时间', | 1895 | startDate: '选择开始时间', |
1853 | endDate: '选择结束时间', | 1896 | endDate: '选择结束时间', |
1854 | });--*/ | 1897 | });--*/ |
1855 | - } else if(currentIndex == 1) { | 1898 | + }; |
1899 | + if(currentIndex == 1) { | ||
1856 | console.log('线下订单'); | 1900 | console.log('线下订单'); |
1857 | this.request_list({ | 1901 | this.request_list({ |
1858 | store_id: os.stoid, | 1902 | store_id: os.stoid, |
@@ -1862,6 +1906,43 @@ Page({ | @@ -1862,6 +1906,43 @@ Page({ | ||
1862 | EndDate: this.data.endDate | 1906 | EndDate: this.data.endDate |
1863 | }); | 1907 | }); |
1864 | }; | 1908 | }; |
1909 | + if(currentIndex == 2) { | ||
1910 | + console.log('卡项订单'); | ||
1911 | + // this.setData({ | ||
1912 | + // orderList: null, | ||
1913 | + // }); | ||
1914 | + // 默认请求全部卡项订单 | ||
1915 | + this.request_list({ | ||
1916 | + store_id: os.stoid, | ||
1917 | + user_id: oo.user_id, | ||
1918 | + }); | ||
1919 | + // let url = '/api/weshop/recharge/user/page'; | ||
1920 | + // let data = { | ||
1921 | + // store_id: os.stoid, | ||
1922 | + // user_id: oo.user_id, | ||
1923 | + // }; | ||
1924 | + // app.promiseGet(url, { | ||
1925 | + // data: data, | ||
1926 | + // }).then(res => { | ||
1927 | + // if(res.data.code == 0) { | ||
1928 | + // console.log('卡项订单请求成功', res); | ||
1929 | + // this.setData({ | ||
1930 | + // orderList: res.data.data.pageData, | ||
1931 | + // }); | ||
1932 | + // } else { | ||
1933 | + // throw(res); | ||
1934 | + // }; | ||
1935 | + // }).catch(err => { | ||
1936 | + // console.log('卡项订单请求失败', err); | ||
1937 | + // this.setData({ | ||
1938 | + // orderList: null, | ||
1939 | + // }); | ||
1940 | + // wx.showToast({ | ||
1941 | + // title: err.data.data, | ||
1942 | + // icon: 'error', | ||
1943 | + // }); | ||
1944 | + // }); | ||
1945 | + }; | ||
1865 | }, | 1946 | }, |
1866 | 1947 | ||
1867 | bindDateChange1: function(e) { | 1948 | bindDateChange1: function(e) { |
@@ -1883,10 +1964,46 @@ Page({ | @@ -1883,10 +1964,46 @@ Page({ | ||
1883 | }, | 1964 | }, |
1884 | 1965 | ||
1885 | searchOnline() { | 1966 | searchOnline() { |
1886 | - console.log('online',this.data.searchContent); | 1967 | + let currentIndex = this.data.currentIndex; |
1968 | + console.log('online',this.data.searchContent, currentIndex); | ||
1887 | if(this.data.searchContent) { | 1969 | if(this.data.searchContent) { |
1888 | console.log(this.data.searchContent); | 1970 | console.log(this.data.searchContent); |
1889 | - this.resetData(), this.requestOrderList(this.data.activeCategoryId); | 1971 | + if(currentIndex == 0) { |
1972 | + this.resetData(), this.requestOrderList(this.data.activeCategoryId); | ||
1973 | + }; | ||
1974 | + if(currentIndex == 2) { // 卡项订单 | ||
1975 | + let url = '/api/weshop/recharge/user/page'; | ||
1976 | + let data = { | ||
1977 | + store_id: os.stoid, | ||
1978 | + user_id: oo.user_id, | ||
1979 | + keyWord: this.data.searchContent, | ||
1980 | + }; | ||
1981 | + this.setData({ | ||
1982 | + tabIndex: 0, | ||
1983 | + }); | ||
1984 | + // 请求数据 | ||
1985 | + app.promiseGet(url, { | ||
1986 | + data: data, | ||
1987 | + }).then(res => { | ||
1988 | + if(res.data.code == 0) { | ||
1989 | + // console.log('卡项订单请求成功', res); | ||
1990 | + this.setData({ | ||
1991 | + cardList: res.data.data, | ||
1992 | + }); | ||
1993 | + } else { | ||
1994 | + throw(res); | ||
1995 | + }; | ||
1996 | + }).catch(err => { | ||
1997 | + // console.log('卡项订单请求失败', err); | ||
1998 | + this.setData({ | ||
1999 | + cardList: null, | ||
2000 | + }); | ||
2001 | + wx.showToast({ | ||
2002 | + title: err.data.data, | ||
2003 | + icon: 'error', | ||
2004 | + }); | ||
2005 | + }); | ||
2006 | + }; | ||
1890 | } else { | 2007 | } else { |
1891 | wx.showToast({ | 2008 | wx.showToast({ |
1892 | title: '您还没有输入搜索内容~', | 2009 | title: '您还没有输入搜索内容~', |
@@ -1980,10 +2097,290 @@ Page({ | @@ -1980,10 +2097,290 @@ Page({ | ||
1980 | }) | 2097 | }) |
1981 | }, | 2098 | }, |
1982 | 2099 | ||
1983 | - go_url(e){ | ||
1984 | - var url=e.currentTarget.dataset.url; | ||
1985 | - getApp().goto(url); | ||
1986 | - } | 2100 | + go_url(e){ |
2101 | + var url=e.currentTarget.dataset.url; | ||
2102 | + getApp().goto(url); | ||
2103 | + }, | ||
2104 | + | ||
2105 | + // 点击卡项订单二级tabbar | ||
2106 | + clickTab(e) { | ||
2107 | + console.log('服务卡项index', e.target.dataset.index); | ||
2108 | + let currentIndex = e.target.dataset.index; | ||
2109 | + | ||
2110 | + let url = '/api/weshop/recharge/user/page'; | ||
2111 | + let data = { | ||
2112 | + store_id: os.stoid, | ||
2113 | + user_id: oo.user_id, | ||
2114 | + }; | ||
2115 | + this.setData({ | ||
2116 | + tabIndex: currentIndex, | ||
2117 | + is_no_data2: 0, | ||
2118 | + is_no_more2: 0, | ||
2119 | + cardList: [], | ||
2120 | + }); | ||
2121 | + | ||
2122 | + | ||
2123 | + switch(currentIndex) { | ||
2124 | + case 0: { // 全部 | ||
2125 | + delete data.order_status; | ||
2126 | + break; | ||
2127 | + }; | ||
2128 | + case 1: { // 待支付 | ||
2129 | + data.order_status = 0; | ||
2130 | + break; | ||
2131 | + }; | ||
2132 | + case 2: { // 待评价 | ||
2133 | + data.order_status = 1; | ||
2134 | + break; | ||
2135 | + }; | ||
2136 | + }; | ||
2137 | + // 请求数据 | ||
2138 | + this.request_list(data); | ||
2139 | + | ||
2140 | + // app.promiseGet(url, { | ||
2141 | + // data: data, | ||
2142 | + // }).then(res => { | ||
2143 | + // if(res.data.code == 0) { | ||
2144 | + // console.log('卡项订单请求成功', res); | ||
2145 | + // this.setData({ | ||
2146 | + // orderList: res.data.data.pageData, | ||
2147 | + // }); | ||
2148 | + // } else { | ||
2149 | + // throw(res); | ||
2150 | + // }; | ||
2151 | + // }).catch(err => { | ||
2152 | + // console.log('卡项订单请求失败', err); | ||
2153 | + // this.setData({ | ||
2154 | + // orderList: null, | ||
2155 | + // }); | ||
2156 | + // wx.showToast({ | ||
2157 | + // title: err.data.data, | ||
2158 | + // icon: 'error', | ||
2159 | + // }); | ||
2160 | + // }); | ||
2161 | + }, | ||
2162 | + | ||
2163 | + // 卡项订单 - 查看详情 | ||
2164 | + viewDetails() { | ||
2165 | + let url = '/packageA/pages/details_serviceCard/details_serviceCard'; | ||
2166 | + app.goto(url); | ||
2167 | + }, | ||
2168 | + | ||
2169 | + // 卡项订单 - 立即支付 | ||
2170 | + pay(e) { | ||
2171 | + let index = e.currentTarget.dataset.index; | ||
2172 | + let item = this.data.cardList[index]; | ||
2173 | + let order_sn = item.order_sn; | ||
2174 | + let store_id = app.globalData.setting.stoid; | ||
2175 | + console.log('go1!!!!!!!!!!!!!!!!!!!!!!!!!',index,item,order_sn,store_id); | ||
2176 | + | ||
2177 | + app.request.post('/api/weshop/order/pay/createRechargeOrder', { | ||
2178 | + data: { | ||
2179 | + parentSn: order_sn, | ||
2180 | + store_id: store_id, | ||
2181 | + }, | ||
2182 | + | ||
2183 | + success: function(res) { | ||
2184 | + var n = res.data.data; | ||
2185 | + self.weixinPay(n, function() { | ||
2186 | + app.showWarning('支付成功'); | ||
2187 | + // setTimeout(function() { | ||
2188 | + // wx.reLaunch({ | ||
2189 | + // url: '/pages/user/my_service/i_service', | ||
2190 | + // }) | ||
2191 | + // }, 1000) | ||
2192 | + }, function() { | ||
2193 | + app.showWarning('支付失败'); | ||
2194 | + // setTimeout(function() { | ||
2195 | + // wx.reLaunch({ | ||
2196 | + // url: '/packageA/pages/cardList/cardList', | ||
2197 | + // }) | ||
2198 | + // }, 1000) | ||
2199 | + }); | ||
2200 | + } | ||
2201 | + }) | ||
2202 | + }, | ||
2203 | + | ||
2204 | + //------调起支付框-------- | ||
2205 | + weixinPay: function(n, success, fail) { | ||
2206 | + if (!n) return false; | ||
2207 | + wx.requestPayment({ | ||
2208 | + timeStamp: String(n.timeStamp), | ||
2209 | + nonceStr: n.nonceStr, | ||
2210 | + package: n.packageValue, | ||
2211 | + signType: n.signType, | ||
2212 | + paySign: n.paySign, | ||
2213 | + success: function(n) { | ||
2214 | + console.log(n), getApp().showSuccess("支付成功!"); | ||
2215 | + "function" == typeof success && success(); | ||
2216 | + wx.redirectTo({ | ||
2217 | + url: "../deposit/deposit" | ||
2218 | + }); | ||
2219 | + }, | ||
2220 | + fail: function(n) { | ||
2221 | + console.log(n), "requestPayment:fail" == n.errMsg ? getApp().showWarning("支付失败") : | ||
2222 | + "requestPayment:fail cancel" == n.errMsg ? getApp().showWarning("您已取消支付") : getApp().showWarning("支付失败:" + n | ||
2223 | + .errMsg.substr("requestPayment:fail ".length)), | ||
2224 | + "function" == typeof fail && fail(); | ||
2225 | + } | ||
2226 | + }); | ||
2227 | + }, | ||
2228 | + | ||
2229 | + // 卡项订单 - 取消订单 | ||
2230 | + // api/weshop/recharge/update?store_id=&order_id=&order_status=3 | ||
2231 | + cancle(e) { | ||
2232 | + wx.showModal({ | ||
2233 | + title: '提示', | ||
2234 | + content: '确定取消订单吗?', | ||
2235 | + success (res) { | ||
2236 | + if (res.confirm) { | ||
2237 | + console.log('取消订单~'); | ||
2238 | + let order_id = e.currentTarget.dataset.orderid; | ||
2239 | + let order_sn = e.currentTarget.dataset.ordersn; | ||
2240 | + app.request.put('/api/weshop/recharge/update', { | ||
2241 | + data: { | ||
2242 | + store_id: os.stoid, | ||
2243 | + order_id: order_id, | ||
2244 | + order_sn: order_sn, | ||
2245 | + order_status: 3, | ||
2246 | + }, | ||
2247 | + success: function(res) { | ||
2248 | + wx.showToast({ | ||
2249 | + title: '取消成功', | ||
2250 | + success: function() { | ||
2251 | + | ||
2252 | + // 这里还可以优化不刷新,后面有时间再优化 | ||
2253 | + self.setData({ | ||
2254 | + is_no_data2: 0, | ||
2255 | + is_no_more2: 0, | ||
2256 | + }); | ||
2257 | + | ||
2258 | + // 这里还可以优化不刷新,后面有时间再优化 | ||
2259 | + self.clickTab(e); | ||
2260 | + }, | ||
2261 | + }); | ||
2262 | + | ||
2263 | + // let index = e.currentTarget.dataset.index; | ||
2264 | + // let cardList = self.data.cardList; | ||
2265 | + // cardList.splice(index, 1); | ||
2266 | + // self.setData({ | ||
2267 | + // cardList, | ||
2268 | + // }); | ||
2269 | + | ||
2270 | + //self.request_list(self.data.currentRequestData); | ||
2271 | + }, | ||
2272 | + }) | ||
2273 | + } else if (res.cancel) { | ||
2274 | + console.log('用户点击取消'); | ||
2275 | + } | ||
2276 | + } | ||
2277 | + }); | ||
2278 | + }, | ||
2279 | + | ||
2280 | + | ||
2281 | + // 卡项订单 - 再来一单 | ||
2282 | + addCart: function(t) { | ||
2283 | + var th = this; | ||
2284 | + var ind = t.currentTarget.dataset.openSpecModal_ind; | ||
2285 | + var action= t.currentTarget.dataset.action; | ||
2286 | + if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind; | ||
2287 | + | ||
2288 | + th.setData({ | ||
2289 | + open_ind_store: ind | ||
2290 | + }); | ||
2291 | + | ||
2292 | + if(!th.data.sto_sele_name){ | ||
2293 | + getApp().my_warnning('请选择门店', 1, th, 450); | ||
2294 | + return false; | ||
2295 | + } | ||
2296 | + | ||
2297 | + | ||
2298 | + if(action=="buy"){ | ||
2299 | + //--------------此时操作的数据------------ | ||
2300 | + var newd = { | ||
2301 | + id: th.data.data.id, | ||
2302 | + goods_num: th.data.goodsInputNum, | ||
2303 | + pick_id: th.data.sto_sele_id, | ||
2304 | + keyid: th.data.sto_sele_keyid, | ||
2305 | + }; | ||
2306 | + newd['pick_name'] = th.data.sto_sele_name; | ||
2307 | + newd['guide_id'] = getApp().globalData.guide_id; | ||
2308 | + newd['guide_type']=0; | ||
2309 | + th.buyNow(newd); | ||
2310 | + }else{ | ||
2311 | + | ||
2312 | + var newd = { | ||
2313 | + service_id: th.data.data.id, | ||
2314 | + service_sn:th.data.data.service_sn, | ||
2315 | + service_name:th.data.data.goods_name, | ||
2316 | + goods_num: th.data.goodsInputNum, | ||
2317 | + pick_id: th.data.sto_sele_id, | ||
2318 | + user_id:oo.user_id, | ||
2319 | + store_id:os.stoid, | ||
2320 | + money:th.data.data.shop_price | ||
2321 | + }; | ||
2322 | + if(getApp().globalData.guide_id){ | ||
2323 | + newd['guide_id'] = getApp().globalData.guide_id; | ||
2324 | + newd['guide_type']=0; | ||
2325 | + } | ||
2326 | + | ||
2327 | + //----先看会员在购物车中是否加入了该商品----- | ||
2328 | + getApp().request.get("/api/weshop/cartService/page", { | ||
2329 | + data: { | ||
2330 | + store_id: os.stoid, | ||
2331 | + user_id: oo.user_id, | ||
2332 | + service_id: th.data.data.id, | ||
2333 | + pick_id: th.data.sto_sele_id, | ||
2334 | + }, | ||
2335 | + success: function(re) { | ||
2336 | + | ||
2337 | + //-------如果购物车中有相关的数据--------- | ||
2338 | + if (re.data.data.total > 0) { | ||
2339 | + var item = re.data.data.pageData[0]; | ||
2340 | + var updata = { | ||
2341 | + id: item.id, | ||
2342 | + goods_num: th.data.goodsInputNum + item.goods_num, | ||
2343 | + money: th.data.data.shop_price, | ||
2344 | + store_id: os.stoid, | ||
2345 | + }; | ||
2346 | + | ||
2347 | + if (getApp().globalData.guide_id) { | ||
2348 | + updata['guide_id'] = getApp().globalData.guide_id; | ||
2349 | + updata['guide_type'] = 1; | ||
2350 | + } | ||
2351 | + getApp().request.put("/api/weshop/cartService/update", { | ||
2352 | + data: updata, | ||
2353 | + success: function(t) { | ||
2354 | + getApp().my_warnning('加入购物车成功', 1, th, 450); | ||
2355 | + var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; | ||
2356 | + th.setData({ | ||
2357 | + cartGoodsNum: c_num | ||
2358 | + }); | ||
2359 | + th.closeSpecModal(); | ||
2360 | + } | ||
2361 | + }); | ||
2362 | + } else { | ||
2363 | + | ||
2364 | + getApp().request.post("/api/weshop/cartService/save", { | ||
2365 | + data: newd, | ||
2366 | + success: function(t) { | ||
2367 | + getApp().my_warnning('加入购物车成功', 1, th, 450); | ||
2368 | + var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; | ||
2369 | + th.setData({ | ||
2370 | + cartGoodsNum: c_num | ||
2371 | + }); | ||
2372 | + th.closeSpecModal(); | ||
2373 | + } | ||
2374 | + }); | ||
2375 | + } | ||
2376 | + } | ||
2377 | + }); | ||
2378 | + | ||
2379 | + } | ||
2380 | + }, | ||
2381 | + | ||
2382 | + | ||
2383 | + | ||
1987 | 2384 | ||
1988 | 2385 | ||
1989 | }); | 2386 | }); |
1990 | \ No newline at end of file | 2387 | \ No newline at end of file |
pages/user/order_list/order_list.wxml
1 | <wxs module="filters" src="../../../utils/filter.wxs"></wxs> | 1 | <wxs module="filters" src="../../../utils/filter.wxs"></wxs> |
2 | + | ||
2 | <view class="container"> | 3 | <view class="container"> |
4 | + <!-- 一级tabbar --> | ||
3 | <view class="tab-container" bindtap="onClickTab"> | 5 | <view class="tab-container" bindtap="onClickTab"> |
4 | <view class="tab {{currentIndex == 0 ? 'active':''}}" data-index="0"><text class="iconfont icon-cloud"></text>线上订单</view> | 6 | <view class="tab {{currentIndex == 0 ? 'active':''}}" data-index="0"><text class="iconfont icon-cloud"></text>线上订单</view> |
7 | + <view class="tab {{currentIndex == 2 ? 'active':''}}" data-index="2" style="display: none;"><text class="iconfont icon-bankcard"></text>卡项订单</view> | ||
5 | <view class="tab {{currentIndex == 1 ? 'active':''}}" data-index="1"><text class="iconfont icon-shop"></text>线下订单</view> | 8 | <view class="tab {{currentIndex == 1 ? 'active':''}}" data-index="1"><text class="iconfont icon-shop"></text>线下订单</view> |
6 | </view> | 9 | </view> |
7 | - <view class="search-container flex" wx:if="{{currentIndex == 0}}"> | 10 | + |
11 | + <!-- 搜索框 --> | ||
12 | + <view class="search-container flex" wx:if="{{currentIndex != 1 }}"> | ||
8 | <input class="search-input" type="text" placeholder="请输入您所搜索的商品" bindinput="bindInput" bindconfirm="bindInput" placeholder-style="color:#ccc;"/> | 13 | <input class="search-input" type="text" placeholder="请输入您所搜索的商品" bindinput="bindInput" bindconfirm="bindInput" placeholder-style="color:#ccc;"/> |
9 | <view class="search-btn" bindtap="searchOnline">搜索</view> | 14 | <view class="search-btn" bindtap="searchOnline">搜索</view> |
10 | </view> | 15 | </view> |
16 | + | ||
17 | + <!-- 二级tabbar - 线上订单 --> | ||
11 | <view class="type-navbar fs28" wx:if="{{currentIndex == 0}}"> | 18 | <view class="type-navbar fs28" wx:if="{{currentIndex == 0}}"> |
12 | <view class="type-box flex-center" wx:for="{{categories}}" wx:key="{{index}}"> | 19 | <view class="type-box flex-center" wx:for="{{categories}}" wx:key="{{index}}"> |
13 | <view id="{{item.id}}" bindtap="changeTab" class="type-navbar-item {{activeCategoryId==item.id?'type-item-on':''}}"> | 20 | <view id="{{item.id}}" bindtap="changeTab" class="type-navbar-item {{activeCategoryId==item.id?'type-item-on':''}}"> |
@@ -15,6 +22,8 @@ | @@ -15,6 +22,8 @@ | ||
15 | </view> | 22 | </view> |
16 | </view> | 23 | </view> |
17 | </view> | 24 | </view> |
25 | + | ||
26 | + <!-- 二级tabbar - 线下订单 --> | ||
18 | <view class="search-container" wx:if="{{currentIndex == 1}}"> | 27 | <view class="search-container" wx:if="{{currentIndex == 1}}"> |
19 | <view class="flex jc_sb"> | 28 | <view class="flex jc_sb"> |
20 | <view class="picker-container flex f1"> | 29 | <view class="picker-container flex f1"> |
@@ -30,7 +39,17 @@ | @@ -30,7 +39,17 @@ | ||
30 | </view> | 39 | </view> |
31 | <view class="fs24 c-9 pdt20">注:读取时段内近10笔记录</view> | 40 | <view class="fs24 c-9 pdt20">注:读取时段内近10笔记录</view> |
32 | </view> | 41 | </view> |
42 | + | ||
43 | + <!-- 二级tabbar - 卡项订单 --> | ||
44 | + <view class="type-navbar fs28" wx:if="{{currentIndex == 2}}"> | ||
45 | + <view class="type-box flex-center f1" wx:for="{{tab_serviceCard}}" wx:key="{{index}}"> | ||
46 | + <view data-index="{{index}}" bindtap="clickTab" class="type-navbar-item {{tabIndex ==index?'type-item-on':''}}"> | ||
47 | + {{item.name}} | ||
48 | + </view> | ||
49 | + </view> | ||
50 | + </view> | ||
33 | </view> | 51 | </view> |
52 | + | ||
34 | <!-- 线上订单 --> | 53 | <!-- 线上订单 --> |
35 | <view class="list-container" wx:if="{{currentIndex == 0}}"> | 54 | <view class="list-container" wx:if="{{currentIndex == 0}}"> |
36 | <view class="stay_evaluate" data-id="{{item.order_id}}" wx:for="{{orderList}}" wx:key="{{index}}"> | 55 | <view class="stay_evaluate" data-id="{{item.order_id}}" wx:for="{{orderList}}" wx:key="{{index}}"> |
@@ -260,8 +279,115 @@ | @@ -260,8 +279,115 @@ | ||
260 | </view> | 279 | </view> |
261 | </view> | 280 | </view> |
262 | </view> | 281 | </view> |
282 | + | ||
283 | +<!-- 服务卡项 --> | ||
284 | +<!-- 订单状态:0=未付款 1=已付款、待评价 2已评价、完成 3已取消 5作废 --> | ||
285 | +<view class="list-container" wx:elif="{{currentIndex == 2}}"> | ||
286 | + <view class="stay_evaluate" data-id="{{item.order_id}}" wx:for="{{cardList}}" wx:key="{{item}}"> | ||
287 | + <!-- 商品编号和状态 --> | ||
288 | + <view class="Commodity_number flex-vertical-between fs24 padding border_bottom"> | ||
289 | + <!--商品编号 --> | ||
290 | + <text selectable='true'>订单编号:{{item.order_sn}}</text> | ||
291 | + <!-- 订单状态 --> | ||
292 | + <view class="flex-center c-r"> | ||
293 | + <view wx:if="{{item.order_status == 0}}">待支付</view> | ||
294 | + <view wx:if="{{item.order_status == 1}}">待评价</view> | ||
295 | + <view wx:if="{{item.order_status == 2}}">已评价</view> | ||
296 | + <view wx:if="{{item.order_status == 3}}" class="c-a9">已取消</view> | ||
297 | + <view wx:if="{{item.order_status == 5}}">已作废</view> | ||
298 | + </view> | ||
299 | + </view> | ||
300 | + | ||
301 | + <!-- 商品详情集合 --> | ||
302 | + <view class="detail_commoditys"> | ||
303 | + <!-- 单个商品 --> | ||
304 | + <view> | ||
305 | + <navigator class="detail_commodity flex-vertical padding" wx:for="{{item.list}}" wx:for-item="goods" wx:for-index="pinx" url="/packageA/pages/details_serviceCard/details_serviceCard?order_id={{item.order_id}}"> | ||
306 | + <!-- 商品图片 --> | ||
307 | + <navigator class="rel"> | ||
308 | + <image src="{{resourceUrl+goods.img_url}}" binderror="bind_bnerr" lazy-load="{{true}}" data-errorimg="orderList[{{index}}].list[{{pinx}}].img_url"></image> | ||
309 | + <!-- <view class="abs flex-center fs26">服务卡</view> --> | ||
310 | + </navigator> | ||
311 | + <!-- 商品内容 --> | ||
312 | + <view class="Commodity_content"> | ||
313 | + <view class="Commodity_goods"> | ||
314 | + <!-- 商品名称 --> | ||
315 | + <view class="goods_name ellipsis-2 fs26">{{goods.service_name}}</view> | ||
316 | + <view class="flex-space-between"> | ||
317 | + <!-- 商品规格 --> | ||
318 | + <!-- <view class="Commodity_spec fs28 flex-center"> --> | ||
319 | + <!--<text class="ellipsis-1" wx:if="{{goods.goods_color.length>1 && goods.goods_spec.length>1}}">{{goods.goods_color+"/"+goods.goods_spec}}</text>--> | ||
320 | + <!--<text class="ellipsis-1" wx:elif="{{goods.goods_color.length>1 || goods.goods_spec.length>1}}">{{goods.goods_color==undefined?"":goods.goods_color}}{{goods.goods_spec==undefined?"":goods.goods_spec}}</text>--> | ||
321 | + <!--<text class="ellipsis-1" wx:else>规格1</text>--> | ||
322 | + <!-- <text class="ellipsis-1">{{filters.show_gui_ge(goods.goods_spec, goods.goods_color)}}</text> --> | ||
323 | + <!-- </view> --> | ||
324 | + </view> | ||
325 | + </view> | ||
326 | + <!-- 商品价格数量 --> | ||
327 | + <view class="Commodity_money flex-vertical-between baseline"> | ||
328 | + <!-- 商品价格 --> | ||
329 | + <view class="flex-vertical c-tb baseline"> | ||
330 | + <view class="fs24">¥</view> | ||
331 | + <!-- 幸运购prom_type等于9 --> | ||
332 | + <!-- 如果是幸运购就显示幸运购参团价格 --> | ||
333 | + <view class="fs26">{{filters.toFix(goods.price,2)}}</view> | ||
334 | + <!-- <view class="fs26" wx:else>{{filters.toFix(goods.member_goods_price,2)}} <text wx:if="{{goods.prom_type==10}}">({{goods.ladder_discount}}折)</text> </view> --> | ||
335 | + </view> | ||
336 | + <view class="fs26 c-a9">x{{goods.qty}}</view> | ||
337 | + </view> | ||
338 | + </view> | ||
339 | + </navigator> | ||
340 | + <!-- 去评价 --> | ||
341 | + <view class="commodity_evaluate jc_sb baseline fs26"> | ||
342 | + <!-- 商品数量 --> | ||
343 | + <view class="commodity_smy fs24"> | ||
344 | + <view class="order-total"> | ||
345 | + <view> | ||
346 | + 共{{filters.count(item.list)}}件商品 | ||
347 | + </view> | ||
348 | + <view class="goods-total flex"> | ||
349 | + <block> | ||
350 | + <view class="commodity_money flex baseline"> | ||
351 | + <view>合计<text wx:if="{{item.discount!=underdefine && item.discount!=null && item.discount!=0}}" style="color:#d60021;">(改)</text>:</view> | ||
352 | + <view class="fs24 c-r">¥</view> | ||
353 | + <view class="c-r">{{filters.toFix(item.account,2)}} | ||
354 | + </view> | ||
355 | + | ||
356 | + </view> | ||
357 | + </block> | ||
358 | + | ||
359 | + </view> | ||
360 | + </view> | ||
361 | + </view> | ||
362 | + | ||
363 | + <view class="links flex-right-vertical fs24 padding"> | ||
364 | + <image wx:if="{{(item.order_status==1&&item.pay_status==1 && item.shipping_status==0 && item.exp_type==1 && !(item.order_goods[0].prom_type==9))}}" class="code" src="{{iurl}}miniapp/images/order/code.png" bindtap="code_show" data-order_sn="{{item.order_sn}}"></image> | ||
365 | + <view bindtap="cancle" class="commodity_To_evaluate flex-level View_evaluation" data-id="{{tabIndex}}" data-orderid="{{item.order_id}}" data-ordersn="{{item.order_sn}}" wx:if="{{(item.order_status==0)}}" data-index="{{tabIndex}}">取消订单</view> | ||
366 | + | ||
367 | + | ||
368 | + <navigator class="commodity_To_evaluate flex-level View_evaluation" url="/packageA/pages/details_serviceCard/details_serviceCard?order_id={{item.order_id}}">订单详情</navigator> | ||
369 | + | ||
370 | + | ||
371 | + <block wx:if="{{item.order_status==1}}"> | ||
372 | + <navigator wx:if="{{item.list.length > 1}}" class="order-btn white bg-orange" | ||
373 | + url="/packageB/pages/user/comment/comment?card=1&status=0&order_id={{item.list[index].order_id}}">评价</navigator> | ||
374 | + <navigator wx:else class="order-btn white bg-orange" | ||
375 | + url="/packageB/pages/user/add_comment/add_comment?card=1&goods_id={{item.list[0].card_id}}&order_id={{item.list[0].order_id}}&price={{item.list[0].price}}">评价</navigator> | ||
376 | + </block> | ||
377 | + | ||
378 | + <navigator class="commodity_To_evaluate flex-level comment_go" bindtap="pay" data-index="{{index}}" wx:if="{{item.order_status==0}}">立即支付</navigator> | ||
379 | + | ||
380 | + | ||
381 | + | ||
382 | + </view> | ||
383 | + </view> | ||
384 | + </view> | ||
385 | + </view> | ||
386 | + </view> | ||
387 | +</view> | ||
388 | + | ||
263 | <!-- 线下订单 --> | 389 | <!-- 线下订单 --> |
264 | -<view class="offline-container" wx:else> | 390 | +<view class="offline-container" wx:elif="{{currentIndex == 1}}"> |
265 | <view class="offline-list"> | 391 | <view class="offline-list"> |
266 | <view class="item" wx:for="{{list2}}"> | 392 | <view class="item" wx:for="{{list2}}"> |
267 | <view class="title"> | 393 | <view class="title"> |
@@ -295,14 +421,14 @@ | @@ -295,14 +421,14 @@ | ||
295 | 421 | ||
296 | 422 | ||
297 | <!-- 没有数据 --> | 423 | <!-- 没有数据 --> |
298 | -<view class="After_all flex-center" wx:if="{{(iscodeall==1 && orderList.length>1 && currentIndex ==0) || (is_no_more2 && currentIndex == 1)}}"> | ||
299 | - <view class="Line"></view> | 424 | +<view class="After_all flex-center" wx:if="{{(iscodeall==1 && orderList.length>1 && currentIndex ==0) || (is_no_more2 && currentIndex == 1) || (is_no_more2 && currentIndex == 2)}}"> |
425 | + <!-- <view class="Line"></view> --> | ||
300 | <view class="end fs26 xc-black">——— 到底了 ———</view> | 426 | <view class="end fs26 xc-black">——— 到底了 ———</view> |
301 | - <view class="Line"></view> | 427 | + <!-- <view class="Line"></view> --> |
302 | </view> | 428 | </view> |
303 | 429 | ||
304 | <!-- 无订单 --> | 430 | <!-- 无订单 --> |
305 | -<view class="empty_order" wx:if="{{((!orderList||orderList.length==0) && is_get && currentIndex == 0) || (list2.length==0 && currentIndex == 1)}}"> | 431 | +<view class="empty_order" wx:if="{{((!orderList||orderList.length==0) && is_get && currentIndex == 0) || (list2.length==0 && currentIndex == 1) || (cardList.length == 0 && currentIndex == 2)}}"> |
306 | <view class="flex-level"> | 432 | <view class="flex-level"> |
307 | <image src="{{iurl}}miniapp/images/order/empty_order.png"></image> | 433 | <image src="{{iurl}}miniapp/images/order/empty_order.png"></image> |
308 | </view> | 434 | </view> |
@@ -313,5 +439,6 @@ | @@ -313,5 +439,6 @@ | ||
313 | </navigator> | 439 | </navigator> |
314 | </view> | 440 | </view> |
315 | </view> | 441 | </view> |
442 | + | ||
316 | <!-- 弹出框扫描 --> | 443 | <!-- 弹出框扫描 --> |
317 | <qr_code id="qc_com"></qr_code> | 444 | <qr_code id="qc_com"></qr_code> |